RE: [R] why won't rq draw lines?

2004-07-20 Thread david_foreman
Thanks, this works for me as well, though the lines extend beyond the Y axes 
(sometimes).  I'm very grateful.  

-- Original Message --
From: "Liaw, Andy" <[EMAIL PROTECTED]>
Date:  Mon, 19 Jul 2004 10:04:55 -0400

>This works for me:
>
>data(engel)
>plot(engel$x, engel$y, xlab="household income", ylab="food expenditure",
> cex=.5)
>taus <- c(.05,.1,.25,.75,.9,.95)
>lapply(taus, function(tau) abline(coef(rq(y~x, data=engel, tau=tau
>
>HTH,
>Andy
>
>> -Original Message-
>> From: [EMAIL PROTECTED]
>> [mailto:[EMAIL PROTECTED] On Behalf Of
>> [EMAIL PROTECTED]
>> Sent: Monday, July 19, 2004 9:53 AM
>> To: [EMAIL PROTECTED]
>> Subject: [R] why won't rq draw lines?
>>
>>
>> I've been trying to draw quantile linear regression lines
>> across a scatterplot of my data using
>>
>> attach(forrq)
>>  plot(PREGNANT,DAY8,xlab="pregnant EPDS",ylab="postnatal
>> EPDS",cex=.5)
>>  taus <- c(.05,.1,.25,.75,.9,.95)
>>  xx <- seq(min(PREGNANT),max(PREGNANT),100)
>>  for(tau in taus){
>>  f <- coef(rq(DAY8~PREGNANT,tau=tau))
>>  yy <- (f[1]+f[2]*xx)
>>  lines(xx,yy)
>>  }
>> which is simply the method from the help file with my dataset
>> attached, and the variable names substituted where
>> appropriate.  I get the scatterplot, but no lines.  Any ideas
>> about what's going on? or wrong?
>>
>>
>> __
>> _
>> Most doctors use http://www.Doctors.net.uk e-mail.
>> Move to a free professional address with spam and virus protection.
>>
>> __
>> [EMAIL PROTECTED] mailing list
>> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide!
>> http://www.R-project.org/posting-guide.html
>>
>>
>
>
>--
>Notice:  This e-mail message, together with any attachments, contains information of 
>Merck & Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), 
>and/or its affiliates (which may be known outside the United States as Merck Frosst, 
>Merck Sharp & Dohme or MSD and in Japan, as Banyu) that may be confidential, 
>proprietary copyrighted and/or legally privileged. It is intended solely for the use 
>of the individual or entity named on this message.  If you are not the intended 
>recipient, and have received this message in error, please notify us immediately by 
>reply e-mail and then delete it from your system.
>--
>
>
>Doctors.net.uk e-mail protects you from viruses and unsolicited messages
>
>


___
Most doctors use http://www.Doctors.net.uk e-mail.
Move to a free professional address with spam and virus protection.

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] why won't rq draw lines?

2004-07-19 Thread Adaikalavan Ramasamy
The example in help(rq) works for me. 

I presume the problem is not due to attach(forrq) as you get the
scatterplot. Why don't you try printing 'xx' and 'yy' inside the loop
and see what you get.

On Mon, 2004-07-19 at 14:53, [EMAIL PROTECTED] wrote:
> I've been trying to draw quantile linear regression lines across a scatterplot of my 
> data using 
> 
> attach(forrq)
>  plot(PREGNANT,DAY8,xlab="pregnant EPDS",ylab="postnatal EPDS",cex=.5)
>  taus <- c(.05,.1,.25,.75,.9,.95)
>  xx <- seq(min(PREGNANT),max(PREGNANT),100)
>  for(tau in taus){
>  f <- coef(rq(DAY8~PREGNANT,tau=tau))
>  yy <- (f[1]+f[2]*xx)
>  lines(xx,yy)
>  }
> which is simply the method from the help file with my dataset attached, and the 
> variable names substituted where appropriate.  I get the scatterplot, but no lines.  
> Any ideas about what's going on? or wrong?
> 
> 
> ___
> Most doctors use http://www.Doctors.net.uk e-mail.
> Move to a free professional address with spam and virus protection.
> 
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] why won't rq draw lines?

2004-07-19 Thread Liaw, Andy
This works for me:

data(engel)
plot(engel$x, engel$y, xlab="household income", ylab="food expenditure",
 cex=.5)
taus <- c(.05,.1,.25,.75,.9,.95)
lapply(taus, function(tau) abline(coef(rq(y~x, data=engel, tau=tau

HTH,
Andy

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> [EMAIL PROTECTED]
> Sent: Monday, July 19, 2004 9:53 AM
> To: [EMAIL PROTECTED]
> Subject: [R] why won't rq draw lines?
> 
> 
> I've been trying to draw quantile linear regression lines 
> across a scatterplot of my data using 
> 
> attach(forrq)
>  plot(PREGNANT,DAY8,xlab="pregnant EPDS",ylab="postnatal 
> EPDS",cex=.5)
>  taus <- c(.05,.1,.25,.75,.9,.95)
>  xx <- seq(min(PREGNANT),max(PREGNANT),100)
>  for(tau in taus){
>  f <- coef(rq(DAY8~PREGNANT,tau=tau))
>  yy <- (f[1]+f[2]*xx)
>  lines(xx,yy)
>  }
> which is simply the method from the help file with my dataset 
> attached, and the variable names substituted where 
> appropriate.  I get the scatterplot, but no lines.  Any ideas 
> about what's going on? or wrong?
> 
> 
> __
> _
> Most doctors use http://www.Doctors.net.uk e-mail.
> Move to a free professional address with spam and virus protection.
> 
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 
>

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html