[R] Grouped regression

David Winsemius dwinsemius at comcast.net
Sun Jul 8 17:30:35 CEST 2012


On Jul 8, 2012, at 7:55 AM, SKrishna wrote:

>
> Hi, Thanks for the reply.
>
>> Sex[120:144]<-factor(TG) #Renaming some males to transgender, to
>> create 3 groups, male, female and transgender
>
> Sorry, that should have been
>
> Sex[120:144]<-factor('TG')
>
> The original line did not have the quotes.

I showed you how to fix that in the reply which you have not copied.  
Is this further evidence that you have not read the Posting Guide?

>
>> I'm getting the sense that this is homework. You offer no information
>> about you business or academic affiliations and appear not to have
>> read the Posting Guide. Also setting up regressions is covered in the
>> "Introduction to R" which you are requested to have reviewed before
>> asking questions on Rhelp. Section 11 would be particularly relevant
>> here.
>
> No, it is not homework, I just used the cats dataset to produce a  
> working
> example, as the Posting Guide suggests. I did not get the  
> information I was
> looking for (how to create a subset regression where the slope and/or
> intercept for some factors were constrained to be the same) from the
> "Introduction to R" which I did look at (along with searching the  
> archives
> of R-help and doing  a general Google search and going through the  
> first 100
> or so results and looking at Julian Faraway's book on Regression  
> Analysis as
> well as some material from John Fox...

The term "subset regression" is not one I recognize but it sounded  
from your description that you wanted what you would get with:

 > out<-lm(Bwt~Sex+Hwt)
 > out

Call:
lm(formula = Bwt ~ Sex + Hwt)

Coefficients:
(Intercept)         SexM        SexTG          Hwt
      1.4716       0.2144       0.6854       0.0965

> --
> View this message in context: http://r.789695.n4.nabble.com/Grouped-regression-tp4635761p4635771.html
> Sent from the R help mailing list archive at Nabble.com.

It is unfortunate that you continue (along with so many users of  
Nabble) to fail to include context.

______________________________________________
> 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.

David Winsemius, MD
Heritage Laboratories
West Hartford, CT



More information about the R-help mailing list