Hi all,
I am using quantile regression with svy design. I want to retrieve
summary regression statistics (std error, p-value), since I don't have
any in my output:
Commands:
clus1_d<- svydesign(id=~cd002_co, weights=~wtper, strata=~str, data=data)
bclus1<-as.svrepdesign(clus1_d,type="bootstrap",replicates=100)
fit1<- withReplicates(bclus1,quote(coef(rq(newm428b~sch_new_2+sch_new_3+sch_new_4,
tau=c(0.05,0.25,0.5,0.75,0.95),weights=wtper))))
Output:
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_new_2 185 -30 -5.500000e+01 -250 -360.0000
sch_new_3 155 20 5.032317e-16 -200 -245.0000
sch_new_4 65 20 -1.500000e+01 -200 -309.9998
Any help will be appreciated.
Best,
C.
Retrieve regression summary results after rq
6 messages · John Kane, Camila Mendes, David Winsemius
summary(fit1) perhaps/ John Kane Kingston ON Canada
-----Original Message-----
From: cacamendes85 at gmail.com
Sent: Wed, 26 Sep 2012 11:39:30 -0300
To: r-help at r-project.org
Subject: [R] Retrieve regression summary results after rq
Hi all,
I am using quantile regression with svy design. I want to retrieve
summary regression statistics (std error, p-value), since I don't have
any in my output:
Commands:
clus1_d<- svydesign(id=~cd002_co, weights=~wtper, strata=~str, data=data)
bclus1<-as.svrepdesign(clus1_d,type="bootstrap",replicates=100)
fit1<-
withReplicates(bclus1,quote(coef(rq(newm428b~sch_new_2+sch_new_3+sch_new_4,
tau=c(0.05,0.25,0.5,0.75,0.95),weights=wtper))))
Output:
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_new_2 185 -30 -5.500000e+01 -250 -360.0000
sch_new_3 155 20 5.032317e-16 -200 -245.0000
sch_new_4 65 20 -1.500000e+01 -200 -309.9998
Any help will be appreciated.
Best,
C.
______________________________________________ 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.
____________________________________________________________ FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your desktop!
This does not work at all...
On Wed, Sep 26, 2012 at 12:04 PM, John Kane <jrkrideau at inbox.com> wrote:
summary(fit1) perhaps/ John Kane Kingston ON Canada
-----Original Message-----
From: cacamendes85 at gmail.com
Sent: Wed, 26 Sep 2012 11:39:30 -0300
To: r-help at r-project.org
Subject: [R] Retrieve regression summary results after rq
Hi all,
I am using quantile regression with svy design. I want to retrieve
summary regression statistics (std error, p-value), since I don't have
any in my output:
Commands:
clus1_d<- svydesign(id=~cd002_co, weights=~wtper, strata=~str, data=data)
bclus1<-as.svrepdesign(clus1_d,type="bootstrap",replicates=100)
fit1<-
withReplicates(bclus1,quote(coef(rq(newm428b~sch_new_2+sch_new_3+sch_new_4,
tau=c(0.05,0.25,0.5,0.75,0.95),weights=wtper))))
Output:
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_new_2 185 -30 -5.500000e+01 -250 -360.0000
sch_new_3 155 20 5.032317e-16 -200 -245.0000
sch_new_4 65 20 -1.500000e+01 -200 -309.9998
Any help will be appreciated.
Best,
C.
______________________________________________ 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.
____________________________________________________________ FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your desktop! Check it out at http://www.inbox.com/marineaquarium
Strange, I have never used it but presumably you are using the package ?survey?? The manual suggests summary(xx) should work. What results or error messages do you get? John Kane Kingston ON Canada
-----Original Message----- From: cacamendes85 at gmail.com Sent: Wed, 26 Sep 2012 12:39:46 -0300 To: jrkrideau at inbox.com Subject: Re: [R] Retrieve regression summary results after rq This does not work at all... On Wed, Sep 26, 2012 at 12:04 PM, John Kane <jrkrideau at inbox.com> wrote:
summary(fit1) perhaps/ John Kane Kingston ON Canada
-----Original Message-----
From: cacamendes85 at gmail.com
Sent: Wed, 26 Sep 2012 11:39:30 -0300
To: r-help at r-project.org
Subject: [R] Retrieve regression summary results after rq
Hi all,
I am using quantile regression with svy design. I want to retrieve
summary regression statistics (std error, p-value), since I don't have
any in my output:
Commands:
clus1_d<- svydesign(id=~cd002_co, weights=~wtper, strata=~str,
data=data)
bclus1<-as.svrepdesign(clus1_d,type="bootstrap",replicates=100)
fit1<-
withReplicates(bclus1,quote(coef(rq(newm428b~sch_new_2+sch_new_3+sch_new_4,
tau=c(0.05,0.25,0.5,0.75,0.95),weights=wtper))))
Output:
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_new_2 185 -30 -5.500000e+01 -250 -360.0000
sch_new_3 155 20 5.032317e-16 -200 -245.0000
sch_new_4 65 20 -1.500000e+01 -200 -309.9998
Any help will be appreciated.
Best,
C.
______________________________________________ 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.
____________________________________________________________ FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your desktop! Check it out at http://www.inbox.com/marineaquarium
____________________________________________________________ GET FREE SMILEYS FOR YOUR IM & EMAIL - Learn more at http://www.inbox.com/smileys Works with AIM?, MSN? Messenger, Yahoo!? Messenger, ICQ?, Google Talk? and most webmails
On Sep 26, 2012, at 8:50 AM, John Kane wrote:
Strange, I have never used it but presumably you are using the package ?survey?? The manual suggests summary(xx) should work. What results or error messages do you get?
She didn't return a model object as fit1. She return only the results of the coef() on the rq(model) object.
Perhaps:
summ1 <- withReplicates(bclus1,
quote( summary( rq( newm428b~sch_new_2+sch_new_3+sch_new_4,
tau=c(0.05,0.25,0.5,0.75,0.95),weights=wtper))))
Untested, and I've never used 'survey' and 'rq' packages together so this is based entirely on analogous reasoning.)
David. > > > John Kane > Kingston ON Canada > > >> -----Original Message----- >> From: cacamendes85 at gmail.com >> Sent: Wed, 26 Sep 2012 12:39:46 -0300 >> To: jrkrideau at inbox.com >> Subject: Re: [R] Retrieve regression summary results after rq >> >> This does not work at all... >> >> On Wed, Sep 26, 2012 at 12:04 PM, John Kane <jrkrideau at inbox.com> wrote: >>> summary(fit1) perhaps/ >>> >>> John Kane >>> Kingston ON Canada >>> >>> >>>> -----Original Message----- >>>> From: cacamendes85 at gmail.com >>>> Sent: Wed, 26 Sep 2012 11:39:30 -0300 >>>> To: r-help at r-project.org >>>> Subject: [R] Retrieve regression summary results after rq >>>> >>>> Hi all, >>>> >>>> I am using quantile regression with svy design. I want to retrieve >>>> summary regression statistics (std error, p-value), since I don't have >>>> any in my output: >>>> >>>> Commands: >>>> >>>> clus1_d<- svydesign(id=~cd002_co, weights=~wtper, strata=~str, >>>> data=data) >>>> bclus1<-as.svrepdesign(clus1_d,type="bootstrap",replicates=100) >>>> fit1<- >>>> withReplicates(bclus1,quote(coef(rq(newm428b~sch_new_2+sch_new_3+sch_new_4, >>>> tau=c(0.05,0.25,0.5,0.75,0.95),weights=wtper)))) >>>> >>>> Output: >>>> >>>> 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_new_2 185 -30 -5.500000e+01 -250 -360.0000 >>>> sch_new_3 155 20 5.032317e-16 -200 -245.0000 >>>> sch_new_4 65 20 -1.500000e+01 -200 -309.9998 >>>> >>>> Any help will be appreciated. >>>> >>>> Best, >>>> >>>> C. >>>> >>>> ______________________________________________ >>>> 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. >>> >>> ____________________________________________________________ >>> FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on >>> your desktop! >>> Check it out at http://www.inbox.com/marineaquarium >>> >>> > > ____________________________________________________________ > GET FREE SMILEYS FOR YOUR IM & EMAIL - Learn more at http://www.inbox.com/smileys > Works with AIM?, MSN? Messenger, Yahoo!? Messenger, ICQ?, Google Talk? and most webmails > > ______________________________________________ > 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. David Winsemius, MD Alameda, CA, USA
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