s-news
[Top] [All Lists]

Obtaining the variable names of a glm

Subject: Obtaining the variable names of a glm
From: Kenneth Cabrera <krcabrer@epm.net.co>
Date: Wed, 27 Nov 2002 22:33:43 -0500
Cc: "S-news (E-mail)" <s-news@wubios.wustl.edu>
References: <Pine.LNX.4.31.0211272010040.20611-100000@gannet.stats>
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0
Hi, S+ users!
Suppose I make a model like this:

model1<-glm(resp~var1+var2+factor1+factor2+var1:factor1+var1:factor1+var2:factor2+var2:factor2,family=poisson)

where "resp" is a response variable (poisson distributed)
"var1" and "var2" are continuous variables
and "factor1" and "factor2" are nominal variables (here I use them as dummy variable)
"factor1" has 2 levels (2 and 8)  and "factor2" 3 levels ( 1, 6 and 12).
Now I want to obtain the labels of the coeficients of the model in 3 separate columns and a
4th column with the corresponding value,

like this:

variable1       variable2      level       value
(intercept)                                          X
var1                                                   X
var2                                                   X
factor1 8 X factor2 6 X factor2 12 X var1 factor1 8 X var1 factor2 6 X var1 factor2 12 X
var2                factor1          8            X
var2                factor2          6            X
var2                factor2          12          X

If I use:
model1$coef, I obtain the name of the coef, but joined.
I want them separated.

Thank you very much for your help!!!


--
Kenneth Roy Cabrera Torres
Celular +57 (315) 405 9339




<Prev in Thread] Current Thread [Next in Thread>