[R] two-way group mean prediction in survreg with three factors

Pang Du pangdu at vt.edu
Fri May 6 15:39:54 CEST 2011


Thank you very much for the reply.  I tend to agree with your first
suggestion.  And that's exactly what I did.

In other functions, an easier way to marginalize such a variable C (not
necessarily a factor) is to use the option 
include=c("A","B","A:B")
This essentially sets C at a value such that the contribution from C is 0.
Unfortunately, this option is not available in survreg for some reason.

Pang


-----Original Message-----
From: Andrew Robinson [mailto:A.Robinson at ms.unimelb.edu.au] 
Sent: Thursday, May 05, 2011 7:55 PM
To: Pang Du
Cc: r-help at r-project.org
Subject: Re: [R] two-way group mean prediction in survreg with three factors

Even then, I think that there's a problem.  If C is in the model, then
the response varies by C.  The simplest way is to pick a value for C,
and then evaluate the group mean estimates of A and B (and C).

Something in my brain keeps asking whether another way to marginalize
C for the purposes of predicting A and B is just to remove it from the
model, or alternatively to make it a random effect.  Neither idea
seems rock solid at this point.  

Cheers

Andrew

On Thu, May 05, 2011 at 09:37:15AM -0400, Pang Du wrote:
> Oops, I hope not too.  Don't know why I had the brackets around B+C.  My
> model is actually A*B+C.  And I'm not sure how to obtain the two-way
> prediction of AB with C marginalized.  Thanks.
> 
> Pang
> 
> -----Original Message-----
> From: Andrew Robinson [mailto:A.Robinson at ms.unimelb.edu.au] 
> Sent: Wednesday, May 04, 2011 10:13 PM
> To: Pang Du
> Cc: r-help at r-project.org
> Subject: Re: [R] two-way group mean prediction in survreg with three
factors
> 
> I hope not!
> 
> Facetiousness aside, the model that you have fit contains C, and,
> indeed, an interaction between A and C.  So, the effect of A upon the
> response variable depends on the level of C.  The summary you want
> must marginalize C somehow, probably by a weighted or unweighted
> average across its levels.  What does that summary really mean?  Can
> you meaningfully average across the levels of a predictor that is
> included in the model as a main and an interaction term?
> 
> Best wishes
> 
> Andrew
> 
> On Wed, May 04, 2011 at 12:24:50PM -0400, Pang Du wrote:
> > I'm fitting a regression model for censored data with three categorical
> > predictors, say A, B, C.  My final model based on the survreg function
is 
> > 
> > Surv(..) ~ A*(B+C).
> > 
> > I know the three-way group mean estimates can be computed using the
> predict
> > function. But is there any way to obtain two-way group mean estimates,
say
> > estimated group mean for (A1, B1)-group?  The sample group means don't
> > incorporate censoring and thus may not be appropriate here.
> > 
> >  
> > 
> > Pang Du
> > 
> > Virginia Tech
> > 
> > 
> > 	[[alternative HTML version deleted]]
> > 
> > ______________________________________________
> > R-help at 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.
> 
> -- 
> Andrew Robinson  
> Program Manager, ACERA 
> Department of Mathematics and Statistics            Tel: +61-3-8344-6410
> University of Melbourne, VIC 3010 Australia               (prefer email)
> http://www.ms.unimelb.edu.au/~andrewpr              Fax: +61-3-8344-4599
> http://www.acera.unimelb.edu.au/
> 
> Forest Analytics with R (Springer, 2011) 
> http://www.ms.unimelb.edu.au/FAwR/
> Introduction to Scientific Programming and Simulation using R (CRC, 2009):

> http://www.ms.unimelb.edu.au/spuRs/

-- 
Andrew Robinson  
Program Manager, ACERA 
Department of Mathematics and Statistics            Tel: +61-3-8344-6410
University of Melbourne, VIC 3010 Australia               (prefer email)
http://www.ms.unimelb.edu.au/~andrewpr              Fax: +61-3-8344-4599
http://www.acera.unimelb.edu.au/

Forest Analytics with R (Springer, 2011) 
http://www.ms.unimelb.edu.au/FAwR/
Introduction to Scientific Programming and Simulation using R (CRC, 2009): 
http://www.ms.unimelb.edu.au/spuRs/



More information about the R-help mailing list