[R] extract cov matrix in summary.rq and use as a matrix.

R. Michael Weylandt <michael.weylandt@gmail.com> michael.weylandt at gmail.com
Mon Dec 5 13:55:45 CET 2011


I'm not at my desk so this is untested, but I'm pretty sure double brackets will do the trick:

qf2_1[[3]]

M 

On Dec 5, 2011, at 7:14 AM, Julia Lira <julia.lira at hotmail.co.uk> wrote:

> 
> Dear all,
> 
> I need to extract the covariance matrix of my quantile regression estimation to use in a test. My regression is:
> 
> qf2_1 <- summary(rq(wb2 ~ apv2 + vol2, tau = phi2[1]), cov = TRUE)
> 
> I can extract the covaraince matrix by using: qf2_1 [3]. However, if I try to use it in the test, it does not work. I only need to transform qf2_1[3] in a matrix 3x3. I have already tried: matrix(qf2_1[3], nrow=3, ncol=3) but it also does not work. By using the latter, I find:
>     [,1]      [,2]      [,3]     
> [1,] Numeric,9 Numeric,9 Numeric,9
> [2,] Numeric,9 Numeric,9 Numeric,9
> [3,] Numeric,9 Numeric,9 Numeric,9
> 
> Is there any other way to do it?
> 
> Thanks a lot in advance!
> 
> All the best,
> 
> Julia
> 
> 
> 
> 
> 
> 
>                         
>    [[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list