boot: Bootstrap functions for LQM and LQMM

View source: R/auxiliary.R

bootR Documentation

Bootstrap functions for LQM and LQMM

Description

This function is used to obtain a bootstrap sample of a fitted LQM or LQMM. It is a generic function.

Usage

boot(object, R = 50, seed = round(runif(1, 1, 10000)), startQR = FALSE)
## S3 method for class 'lqm'
boot(object, R = 50, seed = round(runif(1, 1, 10000)), startQR = FALSE)
## S3 method for class 'lqmm'
boot(object, R = 50, seed = round(runif(1, 1, 10000)), startQR = FALSE)

Arguments

object

an object of class "lqm" or "lqmm".

R

number of bootstrap replications.

seed

optional random number generator seed.

startQR

logical flag. If TRUE the estimated parameters in object are used as starting values in the algorithm applied to each bootstrap sample. This may cause the algorithm to converge too often to a similar optimum, which would ultimately result in underestimated standard errors. If FALSE (recommended), starting values are based on lm.

Value

An object of class boot.lqm is a data frame with R rows and npars columns containing the bootstrap estimates of theta. If object contains results for multiple quantiles, boot.lqm returns an array of dimension c(R,npars,nt), where nt is the length of tau.

An object of class boot.lqmm is a data frame with R rows and npars columns containing the bootstrap estimates of theta_x, theta_z, and scale. If object contains results for multiple quantiles, boot.lqmm returns an array of dimension c(R,npars,nt), where nt is the length of tau. The elements of theta_z are labelled with reStruct. See function covHandling and the example below on how to derive the variance-covariance matrix of the random effects starting from theta_z.

The following attributes are available:

tau

index of the quantile(s).

estimated

the estimated parameter as given by object.

R

number of bootstrap replications.

seed

the random number generator seed used to produce the bootstrap sample.

npars

total numer of parameters.

rdf

the number of residual degrees of freedom.

indices

the bootstrap sample of independent data units.

Author(s)

Marco Geraci

Examples


# boot.lqm
set.seed(123)
n <- 500
test <- data.frame(x = runif(n,0,1))
test$y <- 30 + test$x + rnorm(n)
fit.lqm <- lqm(y ~ x, data = test, tau = 0.5)
fit.boot <- boot(fit.lqm)
str(fit.boot)

# boot.lqmm
data(Orthodont)
fit <- lqmm(distance ~ age, random = ~ 1, group = Subject,
	tau = 0.5, data = Orthodont)
fit.boot <- boot(fit)
str(fit.boot)

lqmm documentation built on April 6, 2022, 5:09 p.m.