Re: [R] plotting multilevel / lme lines

From: <toby909_at_gmail.com>
Date: Fri 06 Apr 2007 - 19:27:49 GMT

Yesterday, I tried to do exactly this, too. Below is my approach. Unfortunately, I did not find a textbook example against which I could verify my code. Hints, simplifications, and verification highly appreciated!!!

### random slope! model
v = lme(POPULAR ~ SEX + TEXP, data=dta, random = ~ SEX | SCHOOL) ### setting up the thing to plot
a = matrix(t(cbind(0, coef(v)[,1], 1, coef(v)[,2])), ncol=2, byrow=1) plot(a)
### connecting only the pairs I want to have connected, ie dont connect all dots for (i in 1:(length(a)/4)*2-1) lines(a[i:(i+1),])

Thanks Toby

data downloaded from http://www.ats.ucla.edu/stat/examples/ma_hox/default.htm

Rense Nieuwenhuis wrote:
> Dear expeRts,
>
> I am trying to plot a lme-object {package nlme) in such a way, that
> on a selected level the x-axis represents the value on a selected
> predictor and the y-axis represents the predicted-outcome variable.
> The graphs would than consist of several lines that each represent
> one group. I can't find such a plotting function.
>
> I could write such a function myself, based on ranef() and fixef(),
> but it would be a waste of time if such a function would already exist.
>
> Does any of you such a function?
>
> Regards,
>
> Rense Nieuwenhuis
>
> ______________________________________________
> R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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. Received on Sat Apr 07 05:42:20 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 06 Apr 2007 - 20:32:55 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.