Title: | Automated Estimation of Sigmoidal and Piecewise Linear Mixed Models |
---|---|
Description: | Estimation of relatively complex nonlinear mixed-effects models, including the Sigmoidal Mixed Model and the Piecewise Linear Mixed Model with abrupt or smooth transition, through a single intuitive line of code and with automated generation of starting values. |
Authors: | Maude Wagner [aut, cre] |
Maintainer: | Maude Wagner <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.5.0 |
Built: | 2025-01-31 03:09:26 UTC |
Source: | https://github.com/maudewagner/nlive |
The dataCog contains 1200 individuals with one line per visit. Repeated measures of global cognition (cognition) were collected over a maximum period of 30 years. Information on the age at death is also provided (ageDeath, ageDeath90).
A data frame with 11867 observations over 1200 subjects and 5 variables:
subject identification number
the retrospective (negative) time before death (in years)
composite score of global cognition
age at death (in years)
age at death centered by the mean
summary(dataCog)
summary(dataCog)
The nlive() function allows to fit a Sigmoidal Mixed Model with 4 parameters, a Piecewise Linear Mixed Model with abrupt change, or a Piecewise Linear Mixed Model with a smooth polynomial transition in the context of longitudinal Gaussian outcomes. This function was designed to be intuitive enough to the less sophisticated users, while using recent developments such as the stochastic approximation expectation-maximization (SAEM) algorithm for efficient estimation. It was designed to optimize the initial values of the main parameters and help interpretation of the output by providing different features such as annotated outputs and graphs.
nlive( model, dataset, ID, outcome, time, predictor.all = NULL, predictor.par1 = NULL, predictor.par2 = NULL, predictor.par3 = NULL, predictor.par4 = NULL, start = NULL, plot.xlabel = NULL, plot.ylabel = NULL, traj.marg = FALSE, traj.marg.group = NULL, spag.plot.title = NULL, traj.marg.title = NULL, traj.marg.group.title = NULL, traj.marg.group.val = NULL )
nlive( model, dataset, ID, outcome, time, predictor.all = NULL, predictor.par1 = NULL, predictor.par2 = NULL, predictor.par3 = NULL, predictor.par4 = NULL, start = NULL, plot.xlabel = NULL, plot.ylabel = NULL, traj.marg = FALSE, traj.marg.group = NULL, spag.plot.title = NULL, traj.marg.title = NULL, traj.marg.group.title = NULL, traj.marg.group.val = NULL )
model |
indicator of the model to fit (1=Sigmoidal Mixed Model, 2=Piecewise Mixed Model with abrupt change, 3=Piecewise Mixed Model with smooth transition) |
dataset |
data frame containing the variables ID, outcome, time, predictor.all, and predictor.par1 to predictor.par4. |
ID |
name of the variable representing the grouping structure specified with " (e.g., "ID" representing the unique identifier of participants). |
outcome |
name of the time-varying variable representing the longitudinal outcome specified with " (e.g., "outcome"). |
time |
name of the variable representing the timescale specified with " (e.g., "time"), which can be negative or positive. |
predictor.all |
optional vector indicating the name of the variable(s) that the four main parameters of the model of interest will be adjusted to (e.g. predictor.all=c("X1","X2")). Default to NULL. |
predictor.par1 |
optional vector indicating the name of the variable(s) that the first main parameter of the model of interest will be adjusted to (e.g. predictor.all=c("X1","X2")). For model 1, the first parameter = last level. For models 2 and 3, first parameter = intercept. Default to NULL. |
predictor.par2 |
optional vector indicating the name of the variable(s) that the second main parameter of the model of interest will be adjusted to (e.g. predictor.all=c("X1","X2")). For model 1, the second parameter = initial level. For models 2 and 3, second parameter = slope before the change-point. Default to NULL. |
predictor.par3 |
optional vector indicating the name of the variable(s) that the third main parameter of the model of interest will be adjusted to (e.g. predictor.all=c("X1","X2"). For model 1, the third parameter = midpoint. For models 2 and 3, third parameter = slope after the change-point. Default to NULL. |
predictor.par4 |
optional vector indicating the name of the variable(s) that the fourth main parameter of the model of interest will be adjusted to (e.g. predictor.all=c("X1","X2")). For model 1, the fourth parameter is the Hill slope. For models 2 and 3, the fourth parameter is the changepoint. Default to NULL. |
start |
optional vector to override the specification of the four initial values for the main parameters. For model 1, the values must be included in the following order: last level, initial level, midpoint, Hill slope. For models 2 and 3, the values must be included in the following order: intercept, slope before the changepoint, slope after the changepoint, changepoint. Default to NULL. |
plot.xlabel |
optional text for the title of the x-axis of all plots |
plot.ylabel |
optional text for the title of the y-axis of all plots |
traj.marg |
optional logical indicating if the marginal estimated trajectory should be plotted for the most common profile of covariates, if any. Default to FALSE. |
traj.marg.group |
optional name of the grouping variable listed in one of the predictor arguments to plot and contrast the estimated marginal trajectories between two specific groups, specified with " (e.g., traj.marg.group="X1"). If the variable is binary, the trajectories are contrasted between the two groups of interest. If the variable is continuous, the 10th and 90th percentile values will automatically be considered. The default value is NULL. |
spag.plot.title |
optional text for the title of the spaghetti plot |
traj.marg.title |
optional text for the title of the marginal estimated trajectory |
traj.marg.group.title |
optional text for the title of the marginal estimated trajectories contrasted between groups |
traj.marg.group.val |
optional vector that can be used when traj.marg.group receives a quantitative variable and that allows to manually specify two percentile values to be considered for contrasting the traj.marg.group. The two values must be between 0 and 1 (e.g., traj.marg.group.val=c(0.2,0.8); for percentiles 20th and 80th). Default to 10th and 90th percentiles (i.e., traj.marg.group.val=c(0.1,0.9)). |
CAUTIONS REGARDING THE USE OF THE FUNCTION
traj.marg: if "TRUE", this argument automatically plots the estimated marginal trajectories of the longitudinal outcome for the most common profile of covariates, if any (i.e., ref "1" for binary variables and mean values for continuous variables). Thus, users must ensure that continuous variables are centered on the mean.
An object of class SaemixObject (from the existing saemix R package) containing the results of the fit of the data by the non-linear mixed model of interest. The nlive function automatically provides (i) a spaghetti plot of the observed outcome for 70 randomly selected statistical units in the dataset and (ii) the standard saemix output, including the fixed effects estimates, the variance of random effects, and Likelihood of the fitted model. The outputs are printed on the terminal and the numerical and graphical outputs are stored in a directory.
Maude Wagner, Ana W. Capuano, Emmanuelle Comets
Capuano AW, Wagner M. nlive: an R package to facilitate the application of the sigmoidal and random changepoint mixed models. BMC Medical Research Methodology. 2023;23(1):257. van den Hout A, Muniz-Terrera G, Matthews F. Smooth random change point models. Statistics in Medicine. 2011;30(6):599-610. Comets E, Lavenu A, Lavielle MM. Parameter estimation in nonlinear mixed effect models using saemix, an R implementation of the SAEM algorithm. Journal of Statistical Software. 2017;80(3):1-41.
nlive.smm
, nlive.pmma
, nlive.pmms
#### Fitting a sigmoidal mixed model - with no covariate ## Not run: head(dataCog) requireNamespace('nlraa') smm.fit = nlive(model=1, dataset=dataCog, ID="ID", outcome="cognition", time="time") ## End(Not run) #### plot(smm.fit): diagnostic plots to assess the goodness-of-fit of smm.fit #### psi(smm.fit): estimates of individual parameters #### Fitting a piecewise mixed model with abrupt change - with no covariate ## Not run: pmm.abrupt.fit = nlive(model=2, dataset=dataCog, ID="ID", outcome="cognition", time="time") ## End(Not run) #### plot(pmm.abrupt.fit): diagnostic plots to assess the goodness-of-fit of pmm.abrupt.fit #### psi(pmm.abrupt.fit): estimates of individual parameters #### Fitting a piecewise mixed model with smooth change - with all parameters #### adjusted for ageDeath90. Here, the nlive() function will also provide a #### plot of the estimated marginal trajectory in the whole study sample. ## Not run: pmm.smooth.fit = nlive(model=3, dataset=dataCog, ID="ID", outcome="cognition", time="time", predictor.all = c("ageDeath90"), traj.marg = TRUE) ## End(Not run) #### plot(pmm.smooth.fit): diagnostic plots to assess the goodness-of-fit of the model #### psi(pmm.smooth.fit): estimates of individual parameters
#### Fitting a sigmoidal mixed model - with no covariate ## Not run: head(dataCog) requireNamespace('nlraa') smm.fit = nlive(model=1, dataset=dataCog, ID="ID", outcome="cognition", time="time") ## End(Not run) #### plot(smm.fit): diagnostic plots to assess the goodness-of-fit of smm.fit #### psi(smm.fit): estimates of individual parameters #### Fitting a piecewise mixed model with abrupt change - with no covariate ## Not run: pmm.abrupt.fit = nlive(model=2, dataset=dataCog, ID="ID", outcome="cognition", time="time") ## End(Not run) #### plot(pmm.abrupt.fit): diagnostic plots to assess the goodness-of-fit of pmm.abrupt.fit #### psi(pmm.abrupt.fit): estimates of individual parameters #### Fitting a piecewise mixed model with smooth change - with all parameters #### adjusted for ageDeath90. Here, the nlive() function will also provide a #### plot of the estimated marginal trajectory in the whole study sample. ## Not run: pmm.smooth.fit = nlive(model=3, dataset=dataCog, ID="ID", outcome="cognition", time="time", predictor.all = c("ageDeath90"), traj.marg = TRUE) ## End(Not run) #### plot(pmm.smooth.fit): diagnostic plots to assess the goodness-of-fit of the model #### psi(pmm.smooth.fit): estimates of individual parameters
The nlive.inspect() function allows to generate basic graphs to describe the longitudinal observed measures of a variable of interest in the dataset
nlive.inspect( dataset, ID, variable, time, plot.xlabel = NULL, plot.ylabel = NULL, spag.plot.title = NULL )
nlive.inspect( dataset, ID, variable, time, plot.xlabel = NULL, plot.ylabel = NULL, spag.plot.title = NULL )
dataset |
data frame containing the ID, variable, and time. |
ID |
name of the variable representing the grouping structure specified with " (e.g., "ID" representing the unique identifier of participants). |
variable |
name of the time-varying variable of interest specified with " (e.g., "variable"). |
time |
name of the variable representing the timescale specified with " (e.g., "time"). Can be negative or positive. |
plot.xlabel |
optional text for the title of the x-axis of all plots. |
plot.ylabel |
optional text for the title of the y-axis of all plots. |
spag.plot.title |
optional text for the title of the spaghetti plot. |
The nlive.inspect function automatically provides (i) an histogram of all the repeated measures of the variable available over time, (ii) a spaghetti plot of the longitudinal observed variable for 70 randomly selected statistical units, (iii) repeated boxplots of the longitudinal observed variable for each time unit. The outputs are printed on the terminal and the numerical and graphical outputs are stored in a directory
Maude Wagner, Ana W. Capuano, Emmanuelle Comets
Capuano AW, Wagner M. nlive: an R package to facilitate the application of the sigmoidal and random changepoint mixed models. BMC Medical Research Methodology. 2023;23(1):257. Hadley Wickham (2016). ggplot2: elegant graphics for data analysis. Springer.
## Not run: nlive.inspect(dataset=dataCog, ID="ID", variable="cognition", time="time") ## End(Not run)
## Not run: nlive.inspect(dataset=dataCog, ID="ID", variable="cognition", time="time") ## End(Not run)
The nlive.pmma() function allows to fit a Piecewise Linear Mixed Models with abrupt change in the context of longitudinal Gaussian outcomes. This function was designed to be intuitive enough to the less sophisticated users, while using recent developments such as the stochastic approximation expectation-maximization (SAEM) algorithm for efficient estimation. It was designed to optimize the initial values of the main parameters and help interpretation of the output by providing different features such as annotated outputs and graphs.
nlive.pmma( dataset, ID, outcome, time, var.all = NULL, var.last.level = NULL, var.slope1 = NULL, var.slope2 = NULL, var.changepoint = NULL, start = NULL, plot.xlabel = NULL, plot.ylabel = NULL, traj.marg = FALSE, traj.marg.group = NULL, traj.marg.title = NULL, traj.marg.group.title = NULL, traj.marg.group.val = NULL )
nlive.pmma( dataset, ID, outcome, time, var.all = NULL, var.last.level = NULL, var.slope1 = NULL, var.slope2 = NULL, var.changepoint = NULL, start = NULL, plot.xlabel = NULL, plot.ylabel = NULL, traj.marg = FALSE, traj.marg.group = NULL, traj.marg.title = NULL, traj.marg.group.title = NULL, traj.marg.group.val = NULL )
dataset |
data frame containing the variables ID, outcome, time, var.all, and all other var. arguments. |
ID |
name of the variable representing the grouping structure specified with " (e.g., "ID" representing the unique identifier of participants). |
outcome |
name of the time-varying variable representing the longitudinal outcome specified with " (e.g., "outcome"). |
time |
name of the variable representing the timescale specified with " (e.g., "time"), which can be negative or positive. |
var.all |
optional vector indicating the name of the variable(s) that the four main parameters of the model will be adjusted to (e.g. var.all=c("X1","X2")). Default to NULL. |
var.last.level |
optional vector indicating the name of the variable(s) that the last level parameter of the model of interest will be adjusted to (e.g. var.last.level=c("X1","X2")). Default to NULL. |
var.slope1 |
optional vector indicating the name of the variable(s) that the slope1 (before changepoint) parameter of the model of interest will be adjusted to (e.g. var.slope1=c("X1","X2"). Default to NULL. |
var.slope2 |
optional vector indicating the name of the variable(s) that the slope2 (after changepoint) parameter of the model of interest will be adjusted to (e.g. var.slope2=c("X1","X2"). Default to NULL. |
var.changepoint |
optional vector indicating the name of the variable(s) that the changepoint parameter of the model of interest will be adjusted to (e.g. var.changepoint=c("X1","X2")). Default to NULL. |
start |
optional vector to override the specification of the four initial values for the main parameters - values must be included in the following order: intercept, slope before the changepoint, slope after the changepoint, changepoint. Default to NULL. |
plot.xlabel |
optional text for the title of the x-axis of all plots. |
plot.ylabel |
optional text for the title of the y-axis of all plots. |
traj.marg |
optional logical indicating if the marginal estimated trajectory should be plotted for the most common profile of covariates, if any. Default to FALSE. |
traj.marg.group |
optional name of the grouping variable listed in one of the predictor arguments to plot and contrast the estimated marginal trajectories between two specific groups, specified with " (e.g., traj.marg.group="X1"). If the variable is binary, the trajectories are contrasted between the two groups of interest. If the variable is continuous, the 10th and 90th percentile values will automatically be considered. The default value is NULL. |
traj.marg.title |
optional text for the title of the marginal estimated trajectory |
traj.marg.group.title |
optional text for the title of the marginal estimated trajectories contrasted between groups |
traj.marg.group.val |
optional vector that can be used when traj.marg.group receives a quantitative variable and that allows to manually specify two percentile values to be considered for contrasting the traj.marg.group. The two values must be between 0 and 1 (e.g., traj.marg.group.val=c(0.2,0.8); for percentiles 20th and 80th). Default to 10th and 90th percentiles (i.e., traj.marg.group.val=c(0.1,0.9)). |
CAUTIONS REGARDING THE USE OF THE FUNCTION
traj.marg: if "TRUE", this argument automatically plots the estimated marginal trajectories of the longitudinal outcome for the most common profile of covariates, if any (i.e., ref "1" for binary variables and mean values for continuous variables). Thus, users must ensure that continuous variables are centered on the mean.
An object of class SaemixObject (from the existing saemix R package) containing the results of the fit of the data by the PMM-abrupt. The nlive.pmma function automatically provides the standard saemix output, including the fixed effects estimates, the variance of random effects, and Likelihood of the fitted model. The outputs are printed on the terminal and the numerical and graphical outputs are stored in a directory.
Maude Wagner, Ana W. Capuano, Emmanuelle Comets
Capuano AW, Wagner M. nlive: an R package to facilitate the application of the sigmoidal and random changepoint mixed models. BMC Medical Research Methodology. 2023;23(1):257. van den Hout A, Muniz-Terrera G, Matthews F. Smooth random change point models. Statistics in Medicine. 2011;30(6):599-610. Comets E, Lavenu A, Lavielle MM. Parameter estimation in nonlinear mixed effect models using saemix, an R implementation of the SAEM algorithm. Journal of Statistical Software. 2017;80(3):1-41.
#### Fitting a piecewise mixed model with abrupt change - with no covariate ## Not run: head(dataCog) pmm.abrupt.fit = nlive.pmma(dataset=dataCog, ID="ID", outcome="cognition", time="time") ## End(Not run) #### plot(pmm.abrupt.fit): diagnostic plots to assess the goodness-of-fit of pmm.abrupt.fit #### psi(pmm.abrupt.fit): estimates of individual parameters
#### Fitting a piecewise mixed model with abrupt change - with no covariate ## Not run: head(dataCog) pmm.abrupt.fit = nlive.pmma(dataset=dataCog, ID="ID", outcome="cognition", time="time") ## End(Not run) #### plot(pmm.abrupt.fit): diagnostic plots to assess the goodness-of-fit of pmm.abrupt.fit #### psi(pmm.abrupt.fit): estimates of individual parameters
The nlive.pmms() function allows to fit a Piecewise Linear Mixed Models with smooth change in the context of longitudinal Gaussian outcomes. This function was designed to be intuitive enough to the less sophisticated users, while using recent developments such as the stochastic approximation expectation-maximization (SAEM) algorithm for efficient estimation. It was designed to optimize the initial values of the main parameters and help interpretation of the output by providing different features such as annotated outputs and graphs.
nlive.pmms( dataset, ID, outcome, time, var.all = NULL, var.last.level = NULL, var.slope1 = NULL, var.slope2 = NULL, var.changepoint = NULL, start = NULL, plot.xlabel = NULL, plot.ylabel = NULL, traj.marg = FALSE, traj.marg.group = NULL, traj.marg.title = NULL, traj.marg.group.title = NULL, traj.marg.group.val = NULL )
nlive.pmms( dataset, ID, outcome, time, var.all = NULL, var.last.level = NULL, var.slope1 = NULL, var.slope2 = NULL, var.changepoint = NULL, start = NULL, plot.xlabel = NULL, plot.ylabel = NULL, traj.marg = FALSE, traj.marg.group = NULL, traj.marg.title = NULL, traj.marg.group.title = NULL, traj.marg.group.val = NULL )
dataset |
data frame containing the variables ID, outcome, time, var.all, and all other var. arguments. |
ID |
name of the variable representing the grouping structure specified with " (e.g., "ID" representing the unique identifier of participants). |
outcome |
name of the time-varying variable representing the longitudinal outcome specified with " (e.g., "outcome"). |
time |
name of the variable representing the timescale specified with " (e.g., "time"), which can be negative or positive. |
var.all |
optional vector indicating the name of the variable(s) that the four main parameters of the model will be adjusted to (e.g. var.all=c("X1","X2")). Default to NULL. |
var.last.level |
optional vector indicating the name of the variable(s) that the last level parameter of the model of interest will be adjusted to (e.g. var.last.level=c("X1","X2")). Default to NULL. |
var.slope1 |
optional vector indicating the name of the variable(s) that the slope1 (before changepoint) parameter of the model of interest will be adjusted to (e.g. var.slope1=c("X1","X2"). Default to NULL. |
var.slope2 |
optional vector indicating the name of the variable(s) that the slope2 (after changepoint) parameter of the model of interest will be adjusted to (e.g. var.slope2=c("X1","X2"). Default to NULL. |
var.changepoint |
optional vector indicating the name of the variable(s) that the changepoint parameter of the model of interest will be adjusted to (e.g. var.changepoint=c("X1","X2")). Default to NULL. |
start |
optional vector to override the specification of the four initial values for the main parameters - values must be included in the following order: intercept, slope before the changepoint, slope after the changepoint, changepoint. Default to NULL. |
plot.xlabel |
optional text for the title of the x-axis of all plots |
plot.ylabel |
optional text for the title of the y-axis of all plots |
traj.marg |
optional logical indicating if the marginal estimated trajectory should be plotted for the most common profile of covariates, if any. Default to FALSE. |
traj.marg.group |
optional name of the grouping variable listed in one of the predictor arguments to plot and contrast the estimated marginal trajectories between two specific groups, specified with " (e.g., traj.marg.group="X1"). If the variable is binary, the trajectories are contrasted between the two groups of interest. If the variable is continuous, the 10th and 90th percentile values will automatically be considered. The default value is NULL. |
traj.marg.title |
optional text for the title of the marginal estimated trajectory |
traj.marg.group.title |
optional text for the title of the marginal estimated trajectories contrasted between groups |
traj.marg.group.val |
optional vector that can be used when traj.marg.group receives a quantitative variable and that allows to manually specify two percentile values to be considered for contrasting the traj.marg.group. The two values must be between 0 and 1 (e.g., traj.marg.group.val=c(0.2,0.8); for percentiles 20th and 80th). Default to 10th and 90th percentiles (i.e., traj.marg.group.val=c(0.1,0.9)). |
CAUTIONS REGARDING THE USE OF THE FUNCTION
traj.marg: if "TRUE", this argument automatically plots the estimated marginal trajectories of the longitudinal outcome for the most common profile of covariates, if any (i.e., ref "1" for binary variables and mean values for continuous variables). Thus, users must ensure that continuous variables are centered on the mean.
An object of class SaemixObject (from the existing saemix R package) containing the results of the fit of the data by the PMM-smooth. The nlive.pmms function automatically provides the standard saemix output, including the fixed effects estimates, the variance of random effects, and Likelihood of the fitted model. The outputs are printed on the terminal and the numerical and graphical outputs are stored in a directory.
Maude Wagner, Ana W. Capuano, Emmanuelle Comets
Capuano AW, Wagner M. nlive: an R package to facilitate the application of the sigmoidal and random changepoint mixed models. BMC Medical Research Methodology. 2023;23(1):257. van den Hout A, Muniz-Terrera G, Matthews F. Smooth random change point models. Statistics in Medicine. 2011;30(6):599-610. Comets E, Lavenu A, Lavielle MM. Parameter estimation in nonlinear mixed effect models using saemix, an R implementation of the SAEM algorithm. Journal of Statistical Software. 2017;80(3):1-41.
#### Fitting a piecewise mixed model with abrupt change - with no covariate ## Not run: head(dataCog) pmm.smooth.fit = nlive.pmms(dataset=dataCog, ID="ID", outcome="cognition", time="time") ## End(Not run) #### plot(pmm.smooth.fit): diagnostic plots to assess the goodness-of-fit of pmm.smooth.fit #### psi(pmm.smooth.fit): estimates of individual parameters
#### Fitting a piecewise mixed model with abrupt change - with no covariate ## Not run: head(dataCog) pmm.smooth.fit = nlive.pmms(dataset=dataCog, ID="ID", outcome="cognition", time="time") ## End(Not run) #### plot(pmm.smooth.fit): diagnostic plots to assess the goodness-of-fit of pmm.smooth.fit #### psi(pmm.smooth.fit): estimates of individual parameters
The nlive.smm() function allows to fit a Sigmoidal Mixed Model with 4 parameters in the context of longitudinal Gaussian outcomes. This function was designed to be intuitive enough to the less sophisticated users, while using recent developments such as the stochastic approximation expectation-maximization (SAEM) algorithm for efficient estimation. It was designed to optimize the initial values of the main parameters and help interpretation of the output by providing different features such as annotated outputs and graphs.
nlive.smm( dataset, ID, outcome, time, var.all = NULL, var.first.level = NULL, var.last.level = NULL, var.midpoint = NULL, var.Hslope = NULL, start = NULL, plot.xlabel = NULL, plot.ylabel = NULL, traj.marg = FALSE, traj.marg.group = NULL, traj.marg.title = NULL, traj.marg.group.title = NULL, traj.marg.group.val = NULL )
nlive.smm( dataset, ID, outcome, time, var.all = NULL, var.first.level = NULL, var.last.level = NULL, var.midpoint = NULL, var.Hslope = NULL, start = NULL, plot.xlabel = NULL, plot.ylabel = NULL, traj.marg = FALSE, traj.marg.group = NULL, traj.marg.title = NULL, traj.marg.group.title = NULL, traj.marg.group.val = NULL )
dataset |
data frame containing the variables ID, outcome, time, var.all, and all other var. arguments. |
ID |
name of the variable representing the grouping structure specified with " (e.g., "ID" representing the unique identifier of participants). |
outcome |
name of the time-varying variable representing the longitudinal outcome specified with " (e.g., "outcome"). |
time |
name of the variable representing the timescale specified with " (e.g., "time"), which can be negative or positive. |
var.all |
optional vector indicating the name of the variable(s) that the four main parameters of the model will be adjusted to (e.g. var.all=c("X1","X2")). Default to NULL. |
var.first.level |
optional vector indicating the name of the variable(s) that the first level parameter of the model will be adjusted to (e.g. var.first.level=c("X1","X2")). Default to NULL. |
var.last.level |
optional vector indicating the name of the variable(s) that the last level parameter of the model of interest will be adjusted to (e.g. var.last.level=c("X1","X2")). Default to NULL. |
var.midpoint |
optional vector indicating the name of the variable(s) that the third main parameter of the model of interest will be adjusted to (e.g. var.midpoint=c("X1","X2"). Default to NULL. |
var.Hslope |
optional vector indicating the name of the variable(s) that the fourth main parameter of the model of interest will be adjusted to (e.g. var.Hslope=c("X1","X2")). Default to NULL. |
start |
optional vector to override the specification of the four initial values for the main parameters - values must be included in the following order: last level, initial level, midpoint, Hill slope. Default to NULL. |
plot.xlabel |
optional text for the title of the x-axis of all plots |
plot.ylabel |
optional text for the title of the y-axis of all plots |
traj.marg |
optional logical indicating if the marginal estimated trajectory should be plotted for the most common profile of covariates, if any. Default to FALSE. |
traj.marg.group |
optional name of the grouping variable listed in one of the predictor arguments to plot and contrast the estimated marginal trajectories between two specific groups, specified with " (e.g., traj.marg.group="X1"). If the variable is binary, the trajectories are contrasted between the two groups of interest. If the variable is continuous, the 10th and 90th percentile values will automatically be considered. The default value is NULL. |
traj.marg.title |
optional text for the title of the marginal estimated trajectory |
traj.marg.group.title |
optional text for the title of the marginal estimated trajectories contrasted between groups |
traj.marg.group.val |
optional vector that can be used when traj.marg.group receives a quantitative variable and that allows to manually specify two percentile values to be considered for contrasting the traj.marg.group. The two values must be between 0 and 1 (e.g., traj.marg.group.val=c(0.2,0.8); for percentiles 20th and 80th). Default to 10th and 90th percentiles (i.e., traj.marg.group.val=c(0.1,0.9)). |
CAUTIONS REGARDING THE USE OF THE FUNCTION
traj.marg: if "TRUE", this argument automatically plots the estimated marginal trajectories of the longitudinal outcome for the most common profile of covariates, if any (i.e., ref "1" for binary variables and mean values for continuous variables). Thus, users must ensure that continuous variables are centered on the mean.
An object of class SaemixObject (from the existing saemix R package) containing the results of the fit of the data by the SMM. The nlive.smm function automatically provides the standard saemix output, including the fixed effects estimates, the variance of random effects, and Likelihood of the fitted model. The outputs are printed on the terminal and the numerical and graphical outputs are stored in a directory.
Maude Wagner, Ana W. Capuano, Emmanuelle Comets
Capuano AW, Wagner M. nlive: an R package to facilitate the application of the sigmoidal and random changepoint mixed models. BMC Medical Research Methodology. 2023;23(1):257. van den Hout A, Muniz-Terrera G, Matthews F. Smooth random change point models. Statistics in Medicine. 2011;30(6):599-610. Comets E, Lavenu A, Lavielle MM. Parameter estimation in nonlinear mixed effect models using saemix, an R implementation of the SAEM algorithm. Journal of Statistical Software. 2017;80(3):1-41.
#### Fitting a sigmoidal mixed model - with no covariate ## Not run: head(dataCog) requireNamespace('nlraa') smm.fit = nlive.smm(dataset=dataCog, ID="ID", outcome="cognition", time="time") ## End(Not run) #### plot(smm.fit): diagnostic plots to assess the goodness-of-fit of smm.fit #### psi(smm.fit): estimates of individual parameters
#### Fitting a sigmoidal mixed model - with no covariate ## Not run: head(dataCog) requireNamespace('nlraa') smm.fit = nlive.smm(dataset=dataCog, ID="ID", outcome="cognition", time="time") ## End(Not run) #### plot(smm.fit): diagnostic plots to assess the goodness-of-fit of smm.fit #### psi(smm.fit): estimates of individual parameters