When invoking boot.rq
like this
b_10 = boot.rq(x, y, tau = .1, bsmethod = "xy", cov = TRUE, R = reps, mofn = mofn)
what does the B
matrix (size R x p) in b_10
contain: bootstrapped coefficient estimates or bootstrapped standard errors?
The Value section in the documentation says:
A list consisting of two elements: A matrix
B
of dimension R by p is returned with the R resampled estimates of the vector of quantile regression parameters. [...]
So, it seems to be the coefficient estimates. But Description section says:
These functions can be used to construct standard errors, confidence intervals and tests of hypotheses regarding quantile regression models.
So it seems to be bootstrapped standard errors.
What is it really?
Edit:
I also wonder what difference the option cov = TRUE
makes. Thanks!
The bootstrapped values are different depending on whether I use cov = TRUE
or not. The code was written by someone else so I'm not sure why that option was put there.
CodePudding user response:
It stores the bootstrap coefficients. Each row of B
is a sample of coefficients, and you have R
rows.
These samples are the basis of further inference. We can compute various statistics from them. For example, to compute bootstrap mean and standard error, we can do:
colMeans(B)
apply(B, 2, sd)
Do you also happen to know what difference the option
cov = TRUE
makes?
Are you sure that cov = TRUE
works? First of all, boot.rq
itself has no such argument. It may be passed in via ...
. However, ...
is forwarded to boot.rq.pxy
(if bsmethod = "pxy"
) or boot.rq.pwxy
(if bsmethod = "pwxy"
), neither of which deals with a cov
argument. Furthermore, you use bsmethod = "xy"
, so ...
will be silently ignored. As far as I could see, cov = TRUE
has no effect at all.
It works in the sense that R doesn't throw me an error.
That is what "silently ignored" means. You can pass whatever into ...
. They are just ignored.
The bootstrapped values are different depending on whether I use
cov = TRUE
or not. The code was written by someone else so I'm not sure why that option was put there.
Random sampling won't give identical results on different runs. I suggest you fix a random seed then do testing:
set.seed(0); ans1 <- boot.rq(..., cov = FALSE)
set.seed(0); ans2 <- boot.rq(..., cov = TRUE)
all.equal(ans1$B, ans2$B)
If you don't get TRUE, come back to me.
You're right. It's just because of the different seeds. Thanks!!