Hi,

I am a very occasional user of R, and will be grateful for some help in constructing a regression across groups.

Here is an example:

library(MASS)
attach(cats)
Sex[120:144]<-factor(TG) #Renaming some males to transgender, to create 3 groups, male, female and transgender

out<-lm(Bwt~Sex/Hwt) #Gives me 3 separate linear regressions for groups M, F and TG

What I now want to do is to examine subsets of this, where groups F and TG have the same slope (and/or intercept). I want to do this in such a way that future calls to anova() for model comparison will recognize the subset structure: so I do not want to just reset the levels with F to TG and then examine the regression.

Thanks much,

Suresh

______________________________________________
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