[R] Comparing 2 slopes of 2 regression lines
Benedikt Niesterok
KleinerHaifisch at gmx.net
Mon Apr 6 12:28:35 CEST 2009
Hello everyone,
I would like to test two regression slopes:do they differ significantly?The data and commands I've used so far:
x<-8.5:32.5 #Vektor x
y<-c( NA , NA , 5.67 , 6.53 , 6.83, 7.41 , 7.93 , 8.5 , 8.86, 9.46 , 9.82 , 10 ,10.35 , 10.7 ,11.03 ,11.37 ,11.61 ,11.84, 12.12, 12.39 ,12.67 ,12.96, 13.28 ,13.47, 13.65) #Vektor y
(regression<-lm(y~x))
summary(regression) Regression model 1
x<-8.5:32.5 #Vektor x
y<-c( NA, 5.88 ,6.95 , 7.2 ,7.66 , 8.02, 8.44, 9.06 , 9.65, 10.22 ,10.63, 11.06, 11.37, 11.91, 12.28 ,12.69 ,13.07 , 13.5 , 13.3 ,14.14 , NA , NA , NA , NA , NA) #Vektor y
(regression<-lm(y~x))
summary(regression) Regression model 2
Now I don't know how to continue as I want to test the slopes only ,not the regression lines in total.
Another problem I have is rather a formal one:
y<-c( NA , NA , 5.67 , 6.53 , 6.83, 7.41 , 7.93 , 8.5 , 8.86, 9.46 , 9.82 , 10 ,10.35 , 10.7 ,11.03 ,11.37 ,11.61 ,11.84, 12.12, 12.39 ,12.67 ,12.96, 13.28 ,13.47, 13.65) #Vektor y
that is my y-vector; I always need to copy and paste this line originating
from:
X8.5 X9.5 X10.5 X11.5 X12.5 X13.5 X14.5 X15.5 X16.5 X17.5
SD24 NA NA 5.67 6.53 6.83 7.41 7.93 8.5 8.86 9.46
X18.5 X19.5 X20.5 X21.5 X22.5 X23.5 X24.5 X25.5 X26.5 X27.5 X28.5
9.82 10 10.35 10.7 11.03 11.37 11.61 11.84 12.12 12.39 12.67
X29.5 X30.5 X31.5 X32.5
12.96 13.28 13.47 13.65
R always considers the original data as different variables(as matrix).
I already tried: y<-as.vector(SD24)
It doesn't work. SD24 is the object giving me the original data you see.
sorry for writing so long; hope it is clear what I wrote.
Thanks for your efforts, Benedikt
--
More information about the R-help
mailing list