I have: f <- ols( y1 ~ (rcs(x1,3) + rcs(x2,3) + rcs(x1,3) %ia% rcs(x2,3) ) ) Then I do: plot(f) This plots y1 against x2 for a given value of x1. Is there a way to make it *also* plot y1 against x1 for a given value of x2? If not, I guess I can do coplot(y1 ~ x1 | x2). Thanks in advance, sp
plotting fit from ols( rcs() )
5 messages · David Winsemius, x, Rolf Turner
On May 2, 2009, at 4:09 PM, x wrote:
I have: f <- ols( y1 ~ (rcs(x1,3) + rcs(x2,3) + rcs(x1,3) %ia% rcs(x2,3) ) ) Then I do: plot(f) This plots y1 against x2 for a given value of x1. Is there a way to make it *also* plot y1 against x1 for a given value of x2?
Are you using the Design/Hmisc packages? If so, then you could get informative plots with: plot(f, x1=NA, x2=NA, method ="contour") # assuming you have used the datadist facilities. This should give you a two dimension display of what might be called iso-levels of y. method= "persp" also works but I find it gives you a plot that has shape but not as much quantitative content. If you want the somewhat more boring plot that you asked for, and x2.spec is set as the level of x2 that you specify, then consider: plot(f, x1=NA, x2=x2.spec)
David Winsemius, MD Heritage Laboratories West Hartford, CT
3 days later
Hi,
While xYplot(...) below produces an empty pdf file, plot(...) works fine. The same xYplot(...) produces correct output if tried directly in R console. Any suggestions?
Thanks,
sp
# empty pdf
trellis.device("pdf", file="./resid1_lat.pdf");
xYplot(resid(f) ~ fitted(f), method='quantile', nx=20,
ylim=c(-100,250), xlim = c(-25,150),
abline=list(h=0, lwd=0.5, lty=2),
xlab="Fitted Values [lat]",
ylab="Residuals [lat]")
dev.off();
# non-empty pdf
trellis.device("pdf", file="./resid1_lat.pdf");
plot(resid(f) ~ fitted(f), method='quantile', nx=20,
ylim=c(-100,250), xlim = c(-25,150),
abline=list(h=0, lwd=0.5, lty=2),
xlab="Fitted Values [lat]",
ylab="Residuals [lat]");
dev.off();
On 6/05/2009, at 12:50 PM, x wrote:
Hi, While xYplot(...) below produces an empty pdf file, plot(...) works fine. The same xYplot(...) produces correct output if tried directly in R console. Any suggestions?
RTFFAQ (7.22)
cheers,
Rolf Turner
######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}
print() fixed it. Thank you! sp
--- On Tue, 5/5/09, Rolf Turner <r.turner at auckland.ac.nz> wrote:
From: Rolf Turner <r.turner at auckland.ac.nz> Subject: Re: [R] xYplot() produces empty pdf To: "to_rent_2000 at yahoo.com" <to_rent_2000 at yahoo.com> Cc: "r-help at r-project.org" <r-help at r-project.org> Date: Tuesday, May 5, 2009, 9:26 PM On 6/05/2009, at 12:50 PM, x wrote:
Hi, While xYplot(...) below produces an empty pdf file,
plot(...) works fine. The same xYplot(...) produces correct output if tried directly in R console. Any suggestions? RTFFAQ (7.22) cheers, Rolf Turner ###################################################################### Attention:This e-mail message is privileged and confidential. If you are not theintended recipient please delete the message and notify the sender.Any views or opinions presented are solely those of the author. This e-mail has been scanned and cleared by MailMarshalwww.marshalsoftware.com ######################################################################