[R] Retrieve regression summary results after rq
Camila Mendes
cacamendes85 at gmail.com
Thu Sep 27 12:32:56 CEST 2012
Hi all, I appreciate your help.
Here are a sample of my script. I appreciate any help.
David, I will go ahead and try your suggestion as well.
Thanks.
----------------------------------------------------
library(survey)
clust<- svydesign(id=id, weights=wtper, strata=strat, data=data)
summary(clust)
library(quantreg)
library(lmtest)
library(car)
library(stats)
#OLS Model
fitols<-(svyglm(y~sch_2+sch_3+sch_4, clust))
# Quantile reg
bclus1<-as.svrepdesign(clust,type="bootstrap",replicates=100)
fit1<- withReplicates(bclus1,quote(coef(rq(y~sch_2+sch_3+sch_4,
tau=c(0.05,0.25,0.5,0.75,0.95),weights=pesonorm))))
# Model diagnosis
coefficients(fit1)
tau= 0.05 tau= 0.25 tau= 0.50 tau= 0.75 tau= 0.95
(Intercept) 2340 2980 3.300000e+03 3750 4360.0000
sch_2 185 -30 -5.500000e+01 -250 -360.0000
sch_3 155 20 5.032317e-16 -200 -245.0000
sch_4 65 20 -1.500000e+01 -200 -309.9998
confint(fit1,level=0.95)
2.5 % 97.5 %
summary(fit1)
tau= 0.05 tau= 0.25 tau= 0.50 tau= 0.75
Min. : 65.0 Min. : -30.0 Min. : -55.0 Min. :-250.0
1st Qu.: 132.5 1st Qu.: 7.5 1st Qu.: -25.0 1st Qu.:-212.5
Median : 170.0 Median : 20.0 Median : -7.5 Median :-200.0
Mean : 686.2 Mean : 747.5 Mean : 807.5 Mean : 775.0
3rd Qu.: 723.8 3rd Qu.: 760.0 3rd Qu.: 825.0 3rd Qu.: 787.5
Max. :2340.0 Max. :2980.0 Max. :3300.0 Max. :3750.0
tau= 0.95
Min. :-360.0
1st Qu.:-322.5
Median :-277.5
Mean : 861.3
3rd Qu.: 906.2
Max. :4360.0
More information about the R-help
mailing list