Hi folks,

 

I am running a very simple regression using 

 

mylm <- lm(mass ~ tarsus, na.action=na.exclude)

 

I would like the use the residuals from this analysis for more
regression but I'm running into a snag when I try 

 

cbind(mylm$residuals, mydata)  # where my data is the original data set

 

The error tells me that it cannot use cbind because the length of
mylm$residuals is 50 and mydata is 52.  This makes sense except I
thought that na.exclude preserves length by inserting NA in residuals
where there were NA's in the orginal data ( i = 3, 20).  When I ask to
see the residuals( mylm$residuals) I see 52 numbers.  How can this be?

 

I am just looking to see how I can produce a third vector with length =
52 and NA's for i=3,20.

 

I'm using R 2.11.1 on Windows XP and the data are below

 

Many thanks,

 

Jeff

 

 

tarsus

mass

 

21.5

23.2

 	 
21.8

22.6

 	 
20.9

NA

 	 
21.6

20.8

 	 
21.5

21.5

 	 
22

23.2

 	 
21.6

23

 	 
22.1

21

 	 
21.1

21

 	 
20.6

22.9

 	 
20.1

21.8

 	 
22.2

20.4

 	 
21.9

21.5

 	 
21.1

21.3

 	 
21.5

20.1

 	 
19.9

21.4

 	 
22.1

27.3

 	 
20.1

19.7

 	 
19.6

16.7

 	 
20.9

NA

 	 
20.1

21.7

 	 
21.8

22.3

 	 
20.9

21.1

 	 
21.6

20.8

 	 
22.4

20.5

 	 
21.4

20.4

 	 
21.4

21

 	 
21.6

21

 	 
21.2

23.3

 	 
21.1

21.9

 	 
22

21

 	 
22.2

21.5

 	 
20.6

20.6

 	 
21.3

20.5

 	 
20.6

20.5

 	 
21.4

20.8

 	 
21.8

21.4

 	 
21.6

19.6

 	 
22.4

24.3

 	 
21.7

20.3

 	 
21.4

21.3

 	 
20.7

18.2

 	 
21.3

20.9

 	 
21.7

20.7

 	 
22.6

20

 	 
22

23

 	 
18.4

20

 	 
20.1

20.6

 	 
19.8

19.1

 	 
21.1

26.3

 	 
19.8

22.3

 	 
21.2

22.2

 	 
19.5

20.6

 	 
19.7

22.7

 	 

 

 

************************************

Jeffrey A. Stratford

Department of Health and Biological Sciences

84 W. South Street

Wilkes University, PA 18766

jeffrey.stratford@wilkes.edu

570-408-4761 (office)

570-332-2942 (cell)

http://web.wilkes.edu/jeffrey.stratford/

************************************




	[[alternative HTML version deleted]]

