[R] how to get "lsmeans"?

John Fox jfox at mcmaster.ca
Thu Mar 22 17:16:56 CET 2007


Dear Frank,

> -----Original Message-----
> From: Frank E Harrell Jr [mailto:f.harrell at vanderbilt.edu] 
> Sent: Thursday, March 22, 2007 10:51 AM
> To: John Fox
> Cc: 'Prof Brian Ripley'; 'r-help'; 'Chuck Cleland'; 'Liaw, Andy'
> Subject: Re: [R] how to get "lsmeans"?
> 
> John Fox wrote:
> > Dear Frank,
> > 
> > The object is to focus on a high-order term of the model, holding 
> > other terms "constant" at typical values; in the case of a 
> factor, a 
> > "typical value" is ambiguous, so an average is taken over 
> the levels of the factor.
> > If the factor is, e.g., gender, one could produce an 
> estimate of the 
> > average fitted value for a population composed equally of men and 
> > women, or of a population composed of men and women in 
> proportion to 
> > their distribution in the data. Otherwise, one would have 
> to produce 
> > separate sets of fitted values for men and women, with the 
> number of 
> > such sets increasing as the number of levels of the factors held 
> > constant increase. On the scale of the linear predictor, 
> these sets would differ only by constants.
> > 
> > Regards,
> >  John
> 
> Makes sense.  I just set other factors to the mode, and if it 
> is important to see estimates for other categories, I give 
> estimates for each factor level.  If I want to uncondition on 
> a variable (not often) I take the proper weighted average of 
> predicted values.
> 

The mode seens arbitrary to me, but I don't think that there's a unique
right answer here. The weighted average (using sample proportions) is what
the effect() function does.

Regards,
 John

> Cheers
> Frank
> 
> > 
> > --------------------------------
> > John Fox
> > Department of Sociology
> > McMaster University
> > Hamilton, Ontario
> > Canada L8S 4M4
> > 905-525-9140x23604
> > http://socserv.mcmaster.ca/jfox
> > --------------------------------
> > 
> >> -----Original Message-----
> >> From: Frank E Harrell Jr [mailto:f.harrell at vanderbilt.edu]
> >> Sent: Thursday, March 22, 2007 8:41 AM
> >> To: John Fox
> >> Cc: 'Prof Brian Ripley'; 'r-help'; 'Chuck Cleland'; 'Liaw, Andy'
> >> Subject: Re: [R] how to get "lsmeans"?
> >>
> >> John Fox wrote:
> >>> Dear Brian et al.,
> >>>
> >>> My apologies for chiming in late: It's been a busy day.
> >>>
> >>> First some general comments on "least-squares means" and
> >> "effect displays."
> >> ... much good stuff deleted ...
> >>
> >> John - the one thing I didn't get from your post is a 
> motivation to 
> >> do all that as opposed to easy-to-explain predicted 
> values.  I would 
> >> appreciate your thoughts.
> >>
> >> Thanks
> >> Frank
> >>
> >> -- 
> >> Frank E Harrell Jr   Professor and Chair           School 
> of Medicine
> >>                       Department of Biostatistics   
> >> Vanderbilt University
> > 
> > 
> 
> 
> -- 
> Frank E Harrell Jr   Professor and Chair           School of Medicine
>                       Department of Biostatistics   
> Vanderbilt University



More information about the R-help mailing list