[R] Simple mean trajectory (ordinal variable)

Frank Harrell f.harrell at vanderbilt.edu
Fri Jun 29 15:29:29 CEST 2012


David - I didn't see a fun= argument to panel.loess
Frank

David Winsemius wrote
> 
> On Jun 28, 2012, at 1:50 PM, Eiko Fried wrote:
> 
>> Hello.
>>
>> I have 5 measurement points, my dependent variable is ordinal (0 -  
>> 3), and
>> I want to visualize my data. I'm pretty new to R.
>> What I want is to find out whether people with different baseline
>> covariates have different trajectories, so I want a plot with the  
>> means
>> trajectory of my dependent variable (the individual points do not  
>> make a
>> lot of sense in ordinal data) on each measurement point per group,  
>> e.g.
>> females vs. males.
>>
>> I found different codes, but they don't work well for me. This one  
>> looks
>> promising, though:
>>
>>> xyplot(phq4 ~ time, data = data, type = 'l',
>>>      panel=function(...){
>>>        panel.xyplot(...)
> 
> If you do not want to plot the points then you should drop the call to  
> xyplot(...)
> 
>>>        panel.loess(...,fun=mean,horizontal=FALSE,col='red',lwd=3)
>>>      }
>>>      )
>>
>> Works and gives me the mean trajectory (I think), but also the  
>> individual
>> trajectories (so I'd like to get rid of them). Also, I would need a  
>> way to
>> build 2 trajectories in 2 graphs ("group=gender" only gives 1 mean
>> trajectory), + standard deviations or something similar that makes  
>> sense as
>> a measure of variance.
>>
>> Thanks
>> -T
>>
>> 	[[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help@ 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
> West Hartford, CT
> 
> ______________________________________________
> R-help@ 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.
> 


-----
Frank Harrell
Department of Biostatistics, Vanderbilt University
--
View this message in context: http://r.789695.n4.nabble.com/Simple-mean-trajectory-ordinal-variable-tp4634801p4634878.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list