[R] regression analysis with interactions

John Sorkin jsorkin at grecc.umaryland.edu
Wed Aug 4 23:02:08 CEST 2010


Jennifer,
Please provide us more information. It would be helpful to see the
actual code you ran along with the actual output. How did you get the
values that your included with your email message? Did you get the
values using the summary function, e.g.

> fit0<-lm(y~x+sex+x*sex)
> summary(fit0)

Call:
lm(formula = y ~ x + sex + x * sex)

Residuals:
      Min        1Q    Median        3Q       Max 
-108.6049  -29.9293   -0.3111   27.8004  165.3499 

Coefficients:
             Estimate Std. Error t value Pr(>|t|)    
(Intercept)   8.62361    8.55021   1.009    0.314    
x             3.88322    0.07252  53.548   <2e-16 ***
sex         -11.78652   12.56677  -0.938    0.349    
x:sex         1.22804    0.10882  11.285   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’
0.1 ‘ ’ 1 

or some other way?
John




John David Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing)>>>
Jennifer Hou <jennifer.hou at hotmail.de> 8/4/2010 4:22 PM >>>

Hello,

I have got a linear model that looks like this:
lm(criterion ~ variable.A*variable.a + variable.B*variable.b +
variable.C *variable.c)

The output computed with stdCoeff() seems to be all right, but it does
not show the coefficients of the interaction of the first pair of
variables. Instead, it shows "NA":

(Intercept) 
NA 
                                                      
variable.A
 0.0925094150 
variable.a
0.1517246479 
variable.B
-0.0023847092 
variable.b
0.0256653197 
variable.C
0.0194313471 
variable.c
0.0192897539 

variable.A : variable.a
NA 
variable.B : variable.b
0.0471111439 
variable.C : variable.c
0.0696702457 

This happens with all my data frames, there is always a problem with
the first pair of variables. Does anyone have an idea why R does not
compute the coefficients of "variable.A : variable.a"?
Thanks in advance!

Best regards,
Jennifer
 		 	   		  
	[[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.

Confidentiality Statement:
This email message, including any attachments, is for th...{{dropped:6}}



More information about the R-help mailing list