Learn R Programming

lmenssp (version 1.2)

boot.nm: A function to calculate bootstrap standard errors

Description

Calculates bootstrap standard errors for the parameter estimates obtained by lmenssp when Nelder-Mead algorithm is used

Usage

boot.nm(formula, data, id, timeVar, result, matern = TRUE, kappa.or.power, nboot = 100, tol.lmenssp = 1e-08, maxiter.lmenssp = 500)

Arguments

formula
a typical R formula for the fixed effects component of the model
data
a data frame from which the variables are to be extracted
id
a numerical vector for subject identification
timeVar
a numerical vector for the time variable
result
a matrix of results obtained by lmenssp, see the example below
matern
a logical variable, TRUE corresponds to Matern correlation function, FALSE corresponds to powered correlation function
kappa.or.power
a numerical value for the shape parameter, it corresponds to $\kappa$ if matern = TRUE and $\phi$ if matern = FALSE
nboot
a numerical value for number of bootstrap sample
tol.lmenssp
a numerical value for the tolerance, to be passed to lmenssp
maxiter.lmenssp
a numerical value for the maximum number of iterations, to be passed to lmenssp

Value

Returns a list of results

Details

This function consider parametric bootstrap based on the fitted model. The recommended number of bootstrap replications is at least 100. For the details of $\kappa$ and $\phi$ in kappa.or.power, see the details section of lmenssp function.

Examples

Run this code
# loading the data set and subsetting it for the first 5 patients 
# for the sake illustration of the usage of the functions
data(data.sim.ibm)
data.sim.ibm.short <- data.sim.ibm[data.sim.ibm$id <= 5, ]

# model formula to be used below
formula <- log.egfr ~ sex + bage + fu + pwl

# fitting the mixed model with Matern, kappa = 0.5
fit.matern <- lmenssp(formula = formula, data = data.sim.ibm.short,
  id = data.sim.ibm.short$id, process = "sgp-matern-0.5", timeVar = data.sim.ibm.short$fu, 
  init = c(-13, 1, -1), silent = FALSE)
fit.matern

# bootstrapping the standard errors, nboot is set to 2 for illustration
# set nboot to at least 100 in your applications
fit.matern.boot <- boot.nm(formula = formula, data = data.sim.ibm.short, 
                           id = data.sim.ibm.short$id, timeVar = data.sim.ibm.short$fu, 
                           result = fit.matern$est, matern = TRUE, kappa.or.power = 0.5, 
                           nboot = 2)
fit.matern.boot

Run the code above in your browser using DataLab