ngme | R Documentation |
Estimates model parameters for longitudinal models using maximum likelihood
implemented by a computationally efficient stochastic gradient algorithm.
See ngme.spatial
for estimation of spatial models.
ngme(
fixed,
random = NULL,
use.process = FALSE,
reffects = "Normal",
process = c("Normal", "fd2"),
error = "Normal",
error_assymetric = FALSE,
data,
timeVar = NULL,
silent = TRUE,
nIter = 1000,
mesh = list(max.dist = NULL, cutoff = NULL, common.grid = FALSE, extend = NULL,
n.cores = 1),
controls = list(learning.rate = 0.2, polyak.rate = -1, nBurnin = 100, nSim = 2,
pSubsample = NULL, nPar.burnin = 0, nIter.fisher = 1000, nSim.fisher = 1000, step0 =
1, alpha = 0.6, nBurnin.learningrate = NULL, nBurnin.base = 0, subsample.type = 4,
pSubsample2 = 0.3, standardize.mixedEffects = FALSE, estimate.fisher = FALSE,
individual.sigma = FALSE, iter.start = 0),
controls.init = list(learning.rate.init = 0, polyak.rate.init = 0.1, nBurnin.init =
100, nSim.init = 2, nIter.init = 1000, pSubsample.init = 0.1, nPar.burnin.init = 0,
step0.init = 0.3, alpha.init = 0.3, nBurnin.learningrate.init = NULL,
nBurnin.base.init = 0, subsample.type.init = 0, pSubsample2.init = 0.3,
standardize.mixedEffects.init = FALSE, individual.sigma.init = FALSE),
init.fit = NULL
)
fixed |
A two-sided formula to specify the fixed effects design matrix. |
random |
A one-sided formula to specify the random effects design matrix. |
use.process |
A logical variable for inclusion of the stochastic process in
the mixed model: |
reffects |
A character string that indicates the distribution of the
random effects. Available options are:
|
process |
A character vector with two elements to specify
the process. Whilst the first element is for the covariance structure, the
second element for the process distribution. Available options for the
first are:
|
error |
A character string to specify the distribution of the error term.
Available options are:
|
error_assymetric |
if true the non-Gaussian error is assymetric |
data |
A data-frame from which the response and covariates to be extracted. |
silent |
A logical value for printing the details of the iterations;
|
nIter |
A numeric value for the number of iteration that will be used by the stochastic gradient. |
mesh |
A list of control variables for creating mesh.
|
controls |
A list of control variables for parameter estimation.
|
controls.init |
A list of control variables to be used to fit the normal model to get the initial values for fitting a model with at least one of random effects, process and error being non-Gaussian.
|
init.fit |
A fitted |
timevar |
A character string that indicates the column name of the time variable
in |
We strongly suggest to use ngme.par
instead of this function, for parallell computations
and automatic stopping criteria. Generic functions summary
, print
and plot
are available for the
output returned by the function ngme
. For Matern covariance function,
currently the shape parameter is set to 0.5 which corresponds to exponential correlation
function.
A list of outputs.
ngme.spatial
## Not run:
data(srft_data)
#Consider a subsample of the data
rs_id <- sample(unique(srft_data$id), 731, replace = FALSE)
srft_data_sub <- srft_data[srft_data$id %in% rs_id, ]
# fit the model with normal assumption for random effects, process and error
fit_normal <- ngme(fixed = log(egfr) ~ sex + bage + fu + pwl,
random = ~ 1|id,
data = srft_data_sub,
reffects = "Normal",
process = c("Normal", "fd2"),
error = "Normal",
timeVar = "fu",
nIter = 1000,
use.process = TRUE,
silent = FALSE,
mesh = list(cutoff = 1/365, max.dist = 1/12, extend = 0.01),
controls = list(pSubsample = 0.1))
#Plot trajectories of fixed effect estimates
plot(fit_normal, param = "fixed")
#plot the other parameter trajectories
par(mfrow=c(2,2))
plot(fit_normal, param = "random")
plot(fit_normal, param = "error")
plot(fit_normal, param = "process")
# fit the model with NIG assumption for all the random components
fit_nig <- update(fit_normal,
reffects = "NIG",
process = c("NIG", "fd2"),
error = "NIG",
init.fit = fit_normal)
#plot updated fixed effect estimates
plot(fit_nig,param="fixed")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.