It is hard to say because we do not have enough information. R has 
approximately 6,000 packages and you have not told us which ones you are using. 
You have not told us much about your data and you have not told us where to 
find the query from August 2006. The basic problem is that your "fit" is not 
the same as the "f" in the query. Your fit object is not very complicated. If 
you look at the output from str(fit) you will see that fit is an "atomic" 
vector (note the wording in your error message) with a series of attributes 
that are probably documented in the help pages for the functions you are using. 
There is nothing called resid inside fit. It is likely that the post you are 
looking at refers to the output from rq(...) or perhaps predict(rq(...)), but 
not the output from withReplicates(..., quote(coef(rq(...)))) which is what fit 
is.

-------------------------------------
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77840-4352

-----Original Message-----
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of Donia Smaali Bouhlila
Sent: Thursday, September 18, 2014 9:54 AM
To: r-help@r-project.org
Subject: [R] Pseudo R squared for quantile regression with replicates

Hi,


I am a new user of r software. I intend to do quantile regressions with 
complex survey data using replicate method. I have ran the following 
commands successfully:


  mydesign 
<-svydesign(ids=~IDSCHOOL,strata=~IDSTRATE,data=TUN,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"))))




I want get the pseudo R squared but I failed. I read a query dating from 
August 2006, [R] Pseudo R for Quant Reg and the answer to it:


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


  I copied it and paste it , replacing f by fit I get this error message:
Error in fit$resid : $ operator is invalid for atomic vectors, I don't 
know what it means

The fit object is likely to be quite complicated  I used str() to see 
what it looks like:



str (fit)
Class 'svrepstat'  atomic [1:19] 713.24 -24.01 -18.37 9.05 7.71 ...
   ..- attr(*, "var")= num [1:19, 1:19] 2839.3 10.2 -122.1 -332.4 -42.3 
...
   .. ..- attr(*, "dimnames")=List of 2
   .. .. ..$ : chr [1:19] "(Intercept)" "Female" "Age" "calculator" ...
   .. .. ..$ : chr [1:19] "(Intercept)" "Female" "Age" "calculator" ...
   .. ..- attr(*, "means")= Named num [1:19] 710.97 -24.03 -18.3 9.39 
7.58 ...
   .. .. ..- attr(*, "names")= chr [1:19] "(Intercept)" "Female" "Age" 
"calculator" ...
   ..- attr(*, "statistic")= chr "theta"

How can I retrieve the residuals?? and calculate the pseudo R squared??


Any help please


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

______________________________________________
R-help@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.
______________________________________________
R-help@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.

Reply via email to