Title: | Pathway Testing for Longitudinal Omics |
---|---|
Description: | A self-contained hypothesis is tested for a given pathway of longitudinal omics. 'SlaPMEG' is a two-step procedure. First, a shared latent process mixed model is fitted over the longitudinal measures of omics in a pathway. This shared model allows deviation from the shared process at subject level (a random intercept, slope, or both per subject) and also at omic level (a random effect per omic). These random effects summarize the longitudinal trend of the observations which can be used to test for group differences using 'Globaltest' in the second step. If the pathway is large or the shared effect is small, the package fits a series of pairwise models and estimates the shared random effects based on them. |
Authors: | Mitra Ebrahimpoor |
Maintainer: | Mitra Ebrahimpoor <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.0.1 |
Built: | 2024-11-23 06:05:09 UTC |
Source: | https://github.com/mitra-ep/slapmeg |
Run slapmeg simultaneously for several pathways. For each pathway a p-value is calculated based
on SLaPMEG prodcedure as in multslapmeg
.
Then the p-values are adjusted for multiple comparisons based on the selected procedure.
multslapmeg(pathlist, fixed, random, grouping, subject, method = "BH", data)
multslapmeg(pathlist, fixed, random, grouping, subject, method = "BH", data)
pathlist |
A list of pathways to be tested. |
fixed |
A one-sided linear formula object for specifying the
fixed-effects in the linear mixed model at the latent process level that
starts with the |
random |
A one-sided formula for the random-effects in the
latent process mixed model and starts with the |
grouping |
name of the covariate representing the grouping structure. |
subject |
name of the covariate representing the repeated measures structure such as subject IDs. |
method |
Correction method for p-values, the default is "BH". For more methods see |
data |
data frame containing the variables named in list of |
A datafram including the name of pathways and corresponding adjusted p-values.
Mitra Ebrahimpoor
Ebrahimpoor, Mitra, Pietro Spitali, Jelle J. Goeman, and Roula Tsonaka. "Pathway testing for longitudinal metabolomics." Statistics in Medicine (2021).
slapmeg
, pairslapmeg
, plotslapmeg
# simulate data with 20 omics testdata<-simslapmeg(nY=20, ntime=5, nsubj = 30, seed=123) head(testdata) # creat a list of 3 random pathways of different sizes pathlist<-list(path1=sample(colnames(testdata)[-c(1:3)],5), path2=sample(colnames(testdata)[-c(1:3)],11), path3=sample(colnames(testdata)[-c(1:3)],9) ) #use mult slampmeg to get test for the differential expression of all pathways #and get adjusted p-values mfit<- multslapmeg(pathlist, ~time, ~1+time, grouping="group", subject="ID", data=testdata) summary(mfit)
# simulate data with 20 omics testdata<-simslapmeg(nY=20, ntime=5, nsubj = 30, seed=123) head(testdata) # creat a list of 3 random pathways of different sizes pathlist<-list(path1=sample(colnames(testdata)[-c(1:3)],5), path2=sample(colnames(testdata)[-c(1:3)],11), path3=sample(colnames(testdata)[-c(1:3)],9) ) #use mult slampmeg to get test for the differential expression of all pathways #and get adjusted p-values mfit<- multslapmeg(pathlist, ~time, ~1+time, grouping="group", subject="ID", data=testdata) summary(mfit)
A seperate lme model is fited per omic in the pathway and the estimates are combined based on the indexes
of pairs to create initial values for the pairslapmeg
function.
pairsetinval(index, fixed, random, subject, data)
pairsetinval(index, fixed, random, subject, data)
index |
Indexes of pairs used for replacing the parameters in the jopint model |
fixed |
A two-sided linear formula object for specifying the
fixed-effects in the linear mixed model at the latent process level. Names
of omics in the pathway are separated by |
random |
A one-sided formula for the random-effects in the
latent process mixed model and starts with the |
subject |
name of the covariate representing the repeated measures structure such as subject IDs. |
data |
data frame containing the variables named in |
A list of vectors, each including vector of initial values corresponding to pairs based on the index file. These vectors will be used as input for multlcmm function of each paired model.
Mitra Ebrahimpoor [email protected]
This function performs pathway testing for longitudinal omics within a two-step framework
just as in slapmeg
but instead of using a joint shared latent model in the
first step, it uses a pairwise approach and runs much faste for larger pathways.
After estimating the random effects of the joint model using pairwise fitting, the random
effects are used within globaltest to compare the two groups at a pathway level.
pairslapmeg(fixed, random, grouping, subject, data)
pairslapmeg(fixed, random, grouping, subject, data)
fixed |
A two-sided linear formula object for specifying the
fixed-effects in the linear mixed model at the latent process level. Names
of omics in the pathway are separated by |
random |
A one-sided formula for the random-effects in the
latent process mixed model and starts with the |
grouping |
name of the covariate representing grouping by the phenotype |
subject |
name of the covariate representing the repeated measures structure such as subject IDs. |
data |
data frame containing the variables named in |
A list is returned including:
call |
the matched call |
nfix |
Number of fixed effect terms in the model, excluding the mandatory intercept |
nrand |
Number of random effect terms in the model |
nsubj |
Number of subjects in the sataset |
nrep |
Table of repeated measures, and number of subjects with the specified number of repeated measures |
tgroup |
Table of grouping, and number of subjects in each group |
Ynames |
Name of the Omics in the pathway |
slapconv |
Status of convergence: For joint method(=1 if the convergence criteria were satisfied, =2 if the maximum number of iterations was reached, =4 or 5 if a problem occured during optimisation); for the pairwise method, proportion of successfully converged pairs is reported |
fixedform |
Names of Fixed effect terms |
randform |
Names of random effect terms |
slapmethod |
The method which is "joint" if the original slapmeg approach is adopted and pairwise for the pairwise method |
SLaP.par |
Fitted values for the parameters in the joint class mixed model in the first step |
Globaltest |
The output from Globaltest at the second step |
EB_pred |
Empirical bayes estimates for the random effects from the joint model |
Mitra Ebrahimpoor
Ebrahimpoor, Mitra, Pietro Spitali, Jelle J. Goeman, and Roula Tsonaka. "Pathway testing for longitudinal metabolomics." Statistics in Medicine (2021).
slapmeg
, multslapmeg
, plotslapmeg
# simulate data with 15 omics testdata<-simslapmeg(nY=25, ntime=3, nsubj = 30, seed=123) head(testdata) #fit slapmeg to test for the differential expression of a pathway of size 15 slapmegfit<- pairslapmeg(Y1+Y2+Y6+Y7+Y8~time, ~1, grouping="group", subject="ID", data=testdata) slapmegfit summary(slapmegfit)
# simulate data with 15 omics testdata<-simslapmeg(nY=25, ntime=3, nsubj = 30, seed=123) head(testdata) #fit slapmeg to test for the differential expression of a pathway of size 15 slapmegfit<- pairslapmeg(Y1+Y2+Y6+Y7+Y8~time, ~1, grouping="group", subject="ID", data=testdata) slapmegfit summary(slapmegfit)
This plot can provide a graphical insight into the source of effect (i.e. diffrential expression) in relevent pathway.
plotslapmeg(obj, ...)
plotslapmeg(obj, ...)
obj |
An slapmeg object which is the output from |
... |
optional graphical parameters can be added with an |
returns NULL
Mitra Ebrahimpoor
Ebrahimpoor, Mitra, Pietro Spitali, Jelle J. Goeman, and Roula Tsonaka. "Pathway testing for longitudinal metabolomics." Statistics in Medicine (2021).
slapmeg
, multslapmeg
, pairslapmeg
# simulate data with 8 omics testdata<-simslapmeg(nY=8, ntime=5, nsubj = 30, seed=123) head(testdata) #fit slapmeg to test for the differential expression of a pathway of size 5 fit<- slapmeg(Y1+Y2+Y6+Y7+Y8~time, ~1, grouping="group", subject="ID", data=testdata) #Density plots for the estimated random effects plotslapmeg(fit)
# simulate data with 8 omics testdata<-simslapmeg(nY=8, ntime=5, nsubj = 30, seed=123) head(testdata) #fit slapmeg to test for the differential expression of a pathway of size 5 fit<- slapmeg(Y1+Y2+Y6+Y7+Y8~time, ~1, grouping="group", subject="ID", data=testdata) #Density plots for the estimated random effects plotslapmeg(fit)
multslapmeg
Provides an overview of mSLaPMEG results for each pathway through multslapmeg
object.
## S3 method for class 'mslapmeg' print(x, ...)
## S3 method for class 'mslapmeg' print(x, ...)
x |
an object inheriting from class |
... |
further arguments to be passed to or from other methods, which will be ignored in this function. |
Returns result summary of mSLAPMEG approach
Mitra Ebrahimpoor
multslapmeg
,slapmeg
, pairslapmeg
slapmeg
Provides an overview of SLaPMEG approach through slapmeg
and pairslapmeg
objects.
## S3 method for class 'slapmeg' print(x, ...)
## S3 method for class 'slapmeg' print(x, ...)
x |
an object inheriting from class |
... |
further arguments to be passed to or from other methods, which will be ignored in this function. |
Returns result summaries of SLAPMEG approach
Mitra Ebrahimpoor
A seperate lme model is fited per omic in the pathway and the estimates are combined to create
initial values for the slapmeg
function.
setinval(fixed, random, subject, data)
setinval(fixed, random, subject, data)
fixed |
A two-sided linear formula object for specifying the
fixed-effects in the linear mixed model at the latent process level. Names
of omics in the pathway are separated by |
random |
A one-sided formula for the random-effects in the
latent process mixed model and starts with the |
subject |
name of the covariate representing the repeated measures structure such as subject IDs. |
data |
data frame containing the variables named in |
A vector of initial values to be used as input for multlcmm function
Mitra Ebrahimpoor
This is a simple function to simulate longitudinal data from a shared latent process mixed effects model
the data provides a good example for application of slapmeg
and pairslapmeg
and pairslapmeg
objects.
simslapmeg( nY, ntime, nsubj, pDif = 1/3, fixed = ~1 + time, random = ~1 + time, fixedbeta = c(0, 2), randbeta = c(0, 2), group, groupbeta = 2, sigma.b, sigma.u, seed = as.integer(runif(1, 0, .Machine$integer.max)), returnpar = FALSE )
simslapmeg( nY, ntime, nsubj, pDif = 1/3, fixed = ~1 + time, random = ~1 + time, fixedbeta = c(0, 2), randbeta = c(0, 2), group, groupbeta = 2, sigma.b, sigma.u, seed = as.integer(runif(1, 0, .Machine$integer.max)), returnpar = FALSE )
nY |
number of omics in the data |
ntime |
number of repeated measures |
nsubj |
number of subjects |
pDif |
proportion of differentially expressed omics in the data (the default is 1/3) |
fixed |
A one-sided formula for the fixed-effects excluding the group variable, the default includes an intercept and time |
random |
A one-sided formula for the random-effects, the default includes an intercept and time |
fixedbeta |
effect size of fixed terms in formula, the length should match the fixed formula, the default is 0 (intercept) and 2 (time) |
randbeta |
effect size of random terms in formula, the length should match the random formula, the default is 0 (intercept) and 2 (time) |
group |
Vector indicating group membership, the length should match the number of subjects, The default is random allocation of half of subjects to each group. If use with slapmeg is intended, the group variable should have only two groups |
groupbeta |
effect size of group variable, the default is 2 |
sigma.b |
variance of the omic- / subject- specific random effects, the length should math |
sigma.u |
Variance of the subject-specific random effects, the length should math the random effects defined in random formula. If not specified, 2 values from normal distribution will be randomly assigned. |
seed |
Value of seed, if not specified a random integer will be assigned |
returnpar |
logical if TRUE, all simulation parameters will be returned along with the simulated data. |
Returns a dataframe where the rows represent the observations and the columns represent the subject Id, time and group variable followed by the omics in pathway; if returnpar is TRUE, a list with both data and parametrs is returned
Mitra Ebrahimpoor
Globaltest is used to test the association between phenotype variable and estimated random effects from step I.
slapGT(EBS, data_inf, rand_nam, Ynames, grouping, Emethod)
slapGT(EBS, data_inf, rand_nam, Ynames, grouping, Emethod)
EBS |
Estimated random effects by either joint or pairwise approach |
data_inf |
Dataframe with variables required for the test |
rand_nam |
Names of random effects defined in model |
Ynames |
Name of omics in pathway |
grouping |
Name of the covariate representing the grouping by the phenotype |
Emethod |
Estimation method for the random effects which is either joint or pairwise |
A GT object containing globaltest results
Mitra Ebrahimpoor
A two-step procedure is adopted, first a joint latent process mixed effects model
is fitted and on the longitudinal data to summarize the temporal trend in terms of
several random effects. For computational efficacy, if the size of pathway is
larger than 10 a paired approah is used to estimate the random effects with the
pairslapmeg
function. The random effects are the input for globaltest which
is used to compare the two groups at a pathway level.
slapmeg(fixed, random, grouping, subject, data, nlimit = 10)
slapmeg(fixed, random, grouping, subject, data, nlimit = 10)
fixed |
A two-sided linear formula object for specifying the
fixed-effects in the linear mixed model at the latent process level. Names
of omics in the pathway are separated by |
random |
A one-sided formula for the random-effects in the
latent process mixed model and starts with the |
grouping |
name of the covariate representing grouping by the phenotype |
subject |
name of the covariate representing the repeated measures structure such as subject IDs. |
data |
data frame containing the variables named in |
nlimit |
A controling arguments telling slapmeg to use pairwise approach for pathways larger than this value, default is 10. Note: fitting the joint model may take long for pathways larger than 20 omics. |
A list is returned including:
call |
the matched call |
nfix |
Number of fixed effect terms in the model, excluding the mandatory intercept |
nrand |
Number of random effect terms in the model |
nsubj |
Number of subjects in the sataset |
nrep |
Table of repeated measures, and number of subjects with the specified number of repeated measures |
tgroup |
Table of grouping, and number of subjects in each group |
Ynames |
Name of the Omics in the pathway |
slapconv |
Status of convergence: For joint method(=1 if the convergence criteria were satisfied, =2 if the maximum number of iterations was reached, =4 or 5 if a problem occured during optimisation); for the pairwise method, proportion of successfully converged pairs is reported |
fixedform |
Names of Fixed effect terms |
randform |
Names of random effect terms |
slapmethod |
The method which is "joint" if the original slapmeg approach is adopted and pairwise for the pairwise method |
SLaP.par |
Fitted values for the parameters in the joint class mixed model in the first step |
Globaltest |
The output from Globaltest at the second step |
EB_pred |
Empirical bayes estimates for the random effects from the joint model |
Mitra Ebrahimpoor
Ebrahimpoor, Mitra, Pietro Spitali, Jelle J. Goeman, and Roula Tsonaka. "Pathway testing for longitudinal metabolomics." Statistics in Medicine (2021).
multslapmeg
, pairslapmeg
, plotslapmeg
# simulate data with 8 omics testdata<-simslapmeg(nY=8, ntime=5, nsubj = 30, seed=123) head(testdata) #fit slapmeg to test for the differential expression of a pathway of size 5 fit<- slapmeg(Y1+Y2+Y6+Y7+Y8~time, ~1, grouping="group", subject="ID", data=testdata) fit summary(fit)
# simulate data with 8 omics testdata<-simslapmeg(nY=8, ntime=5, nsubj = 30, seed=123) head(testdata) #fit slapmeg to test for the differential expression of a pathway of size 5 fit<- slapmeg(Y1+Y2+Y6+Y7+Y8~time, ~1, grouping="group", subject="ID", data=testdata) fit summary(fit)
slapmeg
objectsProvides a table of sorted p-values for the output of multSLaPMEG approach within multslapmeg
objects.
## S3 method for class 'mslapmeg' summary(object, n = 5, ...)
## S3 method for class 'mslapmeg' summary(object, n = 5, ...)
object |
an object inheriting from classes |
n |
an integer indicating number of pathways to be printed the default is 5 |
... |
further arguments to be passed to or from other methods, which will be ignored in this function. |
'Returns the fixed effect estimates and random effects variances from the model in step 1 and the details of Globaltest along with p-value from step 2.
Mitra Ebrahimpoor
slapmeg
objectsProvides a summary of values estimated with SLaPMEG approach within slapmeg
and pairslapmeg
objects.
## S3 method for class 'slapmeg' summary(object, ...)
## S3 method for class 'slapmeg' summary(object, ...)
object |
an object inheriting from classes |
... |
further arguments to be passed to or from other methods, which will be ignored in this function. |
'Returns the fixed effect estimates and random effects variances from the model in step 1 and the details of Globaltest along with p-value from step 2.
Mitra Ebrahimpoor