bootwrq: Bootstrap procedure for weighted quantile regressions

Description Usage Arguments Value Author(s) See Also Examples

View source: R/bootwrq.R

Description

A subject-level bootstrap method for weighted quantile regressions is implemented in this function. Quantile regressions are estimated in a generalized estimating equation framework with independent working covariance matrix. Weights are estimated using weightsIMD or weightsMMD functions.

Usage

1
2
3
4
bootwrq(B, form, tau, data, Y, X1 = NULL, X2 = NULL, subject,
death, time, interval.death = NULL, impute = NULL, weight = NULL,
wcompute = 2, seed = NULL, intermittent, file = NULL,
nproc = 1, MPI = FALSE)

Arguments

B

integer, number of bootstrap samples

form

formula indicating the quantile regression model to be estimated

tau

numeric vector indicating the quantiles to be estimated

data

data frame containing the data

Y

character indicating the name of the response outcome

X1

optional character vector passed to the weight functions

X2

optional character vector passed to the weight functions

subject

character indicating the name of the subject identifier

death

optional character passed to the weight functions

time

optional character passed to the weight functions

interval.death

optional numeric vector passed to the weight function weightsMMD

impute

optional numeric vector passed to the weight function weightsIMD

weight

character indicating the name of the weight variable in data

wcompute

integer indicating if weights should be estimated in each bootstrap sample. If wcompute=0, weights are supposed to be known. If wcompute=1, weights are re-estimated in each bootstrp sample. If wcompute=2, both results are returned.

seed

optional integer vector of length B indicating the seeds.

intermittent

logical indicating if data contains intermittent missing data. If intermittent=TRUE, the weights are estimated using weightsIMD function, if intermittent=FALSE, the weights are estimated using weightsMMD function.

file

optional character indicating the name of the results file. If file=NULL, no results file is created.

nproc

number of processors to be used for parallel computing. Default to 1, sequential computation.

MPI

logical indicating if MPI parallelization should be used. Default to FALSE.

Value

a matrix with B columns containing the results on each bootstrap sample.

Author(s)

Viviane Philipps, Robert Darlin Mba

See Also

summary.bootwrq, test.bootwrq

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## Not run: 
## computation of the weights with intermittent missing data 
w_simdata <- weightsIMD(data=simdata,Y="Y",X1="X",X2=NULL,subject="id",
death="death",time="time",impute=20,name="w_imd")$data

## estimation of the weighted quantile regressions
## for the first quartile and the median
m_simdata <- rq(Y~time*X,data=w_simdata,weights=w_imd,tau=c(0.25,0.5))

## estimation of the standard erros using the bootstrap procedure
boot_simdata <- bootwrq(B=1000, form=Y~time*X, tau=c(0.25,0.5),
data=w_simdata, Y="Y",X1="X",X2=NULL,subject="id",
death="death",time="time",impute=20,wcompute=0,intermittent=TRUE)

## the summary of the results
summary(boot_simdata,m_simdata)

## comparison of the covariate effects
## between the first quartile and the median
test.bootwrq(boot_simdata,m_simdata)

## End(Not run)

weightQuant documentation built on Jan. 5, 2022, 5:08 p.m.