Re: [Rd] matching predictors and dummies

2008-07-12 Thread Mark Difford

Hi Jeroen,

>> How could i use the model$terms to extract which coefficients belong to
>> which factor, 
>> the way anova() does it?

There may be a simpler ("canned") way to do it, but why don't you debug
anova.lm to see how it does it?

##
methods("anova")
anova.lm

HTH, Mark.


Jeroen Ooms wrote:
> 
> 
> Charles C. Berry wrote:
>> 
>> See
>>  ?terms
>>  ?terms.object
>> 
>> 
>> 
> 
> I am sorry but i cannot figure out how i can find out which coefficients
> belong to which predictors using the model$terms. If i do
> attributes(model$terms) i get a nice list which contains the orriginal
> factors and some more information, and from model$xlevels i can see the
> levels of these factors. However, it does not say anywhere which of the
> model$coefficients belong to which factor. The only thing i can imagine is
> assuming that the dummy names are simply the concatenation of the factor
> name and the level name, which seems to be the default behavior. But
> preferebly i would not want to make my program rely on this assumption.
> How could i use the model$terms to extract which coefficients belong to
> which factor, the way anova() does it?
> 
> 

-- 
View this message in context: 
http://www.nabble.com/matching-predictors-and-dummies-tp18405023p18416554.html
Sent from the R devel mailing list archive at Nabble.com.

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] matching predictors and dummies

2008-07-12 Thread Jeroen Ooms


Charles C. Berry wrote:
> 
> See
>   ?terms
>   ?terms.object
> 
> 
> 

I am sorry but i cannot figure out how i can find out which coefficients
belong to which predictors using the model$terms. If i do
attributes(model$terms) i get a nice list which contains the orriginal
factors and some more information, and from model$xlevels i can see the
levels of these factors. However, it does not say anywhere which of the
model$coefficients belong to which factor. The only thing i can imagine is
assuming that the dummy names are simply the concatenation of the factor
name and the level name, which seems to be the default behavior. But
preferebly i would not want to make my program rely on this assumption. How
could i use the model$terms to extract which coefficients belong to which
factor, the way anova() does it?

-- 
View this message in context: 
http://www.nabble.com/matching-predictors-and-dummies-tp18405023p18410832.html
Sent from the R devel mailing list archive at Nabble.com.

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel