[R] quantile regression with complex survey data

Donia Smaali Bouhlila sma.ali at fsjegj.rnu.tn
Tue Sep 16 23:39:28 CEST 2014


Dear r Users,
I am new in r. I am trying to estimate regression quantiles in complex 
surveys.I used these commands.

  mydesign 
<-svydesign(ids=~IDSCHOOL,strata=~IDSTRATE,data=TUNISIA,nest=TRUE,weights=~TOTWGT)
bootdesign <-  as.svrepdesign(mydesign,type="auto",replicates=150)
fit<withReplicates(bootdesign,quote(coef(rq(Math1~Female+Age+calculator+computer+desk
+dictionary+internet+work+Book2+Book3+Book4+Book5+Pedu1+Pedu2+Pedu3+Pedu4+Born1+Born2,tau=0.5,weights=.weights, 
method="fn"))))



  However, I don't get the results of the estimated coefficients.In 
addition, I don't know how to calculate pseudo R squared.

When I type summary (fit) , I get the following results:

summary (fit)
    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
-33.340  -6.358  12.200  38.800  17.510 645.700

For the pseudo R squared , I read the post [R] Pseudo R for Quant Reg 
showing how to compute it:

rho <- function(u,tau=.5)u*(tau - (u < 0))
	V <- sum(rho(f$resid, f$tau))


when I type

  > rho <- function(u,tau=.5)u*(tau - (u < 0))
V <- sum(rho(fit$resid, fit$tau))

I get the following message
Error in fit$resid : $ operator is invalid for atomic vectors



Any help please


-- 
Dr. Donia Smaali Bouhlila
Associate-Professor
Department of Economics
Faculté des Sciences Economiques et de Gestion de Tunis



More information about the R-help mailing list