I want to create an array of 38 rows and two columns with coefficients in the odd rows and the confidence intervals for the parameters in even rows.
Then call stargazer .
My code is:
library(quantreg)
y <- rnorm(200)
x <- matrix(rnorm(123),200)
fit <- rq(y~x,tau=seq(0.05, 0.95, by = 0.05),method="br")
summary(fit,se="nid")
I've been able to move this far:
Notice that I can put the coefficients on even odd rows. The obvious error is when I try to construct and put the parameter confidence interval on even lines:
fit_Matrix<-matrix(0,38,2)
for(i in 1:19) for (j in seq(1, 38, by = 2)[i]) for (k in seq(2, 38, by = 2)[i]) {
fit_Matrix[j,1]<-summary(fit,se="nid")[[i]]$coefficients[1]
fit_Matrix[j,2]<-summary(fit,se="nid")[[i]]$coefficients[2]
fit_Matrix[k,1]<-summary(fit,se="nid")[[i]]$coefficients[1]-1.645*summary(fit,se="nid")[[i]]$coefficients[3];
summary(fit,se="nid")[[i]]$coefficients[1]+1.645*summary(fit,se="nid")[[i]]$coefficients[3]
fit_Matrix[k,2]<-summary(fit,se="nid")[[i]]$coefficients[2]-1.645*summary(fit,se="nid")[[1]]$coefficients[4];
summary(fit,se="nid")[[i]]$coefficients[2]-1.645*summary(fit,se="nid")[[i]]$coefficients[4]
}
The second part of the code is wrong. How do I fix it? Remembering that you would like to transport the array to LaTeX.
Thank you in advance.