Bert,

Can you provide an example how to pass the conditioned data set?

xyplot( x~y | z, data=mydata,
panel=function(...){ 
mod=lm(x~ y+w +q, data=??)
panel.lines(fitted(mod))

}

If I use mydata in place of ?? I get a global fit, not a fit for each level of 
z, which is what I want.

Stephen B


-----Original Message-----
From: Bert Gunter [mailto:gunter.ber...@gene.com] 
Sent: Tuesday, October 07, 2014 9:30 AM
To: Bond, Stephen
Cc: r-help@R-project.org
Subject: Re: [R] lattice add a fit

Fit your model in the panel function using lm and plot the fits using 
?panel.points, ?panel.lines, etc.

-- Bert

Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374

"Data is not information. Information is not knowledge. And knowledge is 
certainly not wisdom."
Clifford Stoll




On Tue, Oct 7, 2014 at 6:01 AM, Bond, Stephen <stephen.b...@cibc.com> wrote:
> What is the way to add an arbitrary fit from a model to a lattice 
> conditioning plot ?
>
> For example
> xyplot(v1 ~v2 | v3,data=mydata,
>         panel=function(...){
>             panel.xyplot(...)
>             panel.loess(...,col.line="red")
>         }
> )
> Will add a loess smoother. Instead, I want to put a fit from lm (but 
> not a simple straight line) and the fit has to be done for each panel 
> separately, not one fit for the full data set, so sth like an lm equivalent 
> of panel.locfit (there is no panel.lmfit) Thank you.
>
> Stephen B
>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> 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