Hi r-help-boun...@r-project.org napsal dne 06.04.2009 12:28:35:
> 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. Here is one approach http://tolstoy.newcastle.edu.au/R/e6/help/09/01/2632.html > > 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 You probably read SD24 from some source by read.delim which suppose the first line is header and subsequent lines (in your case only one) are data. I would try to read it with header = FALSE option. You shall get data frame with 2 lines and you could then use t(your.reed.data) to transpose it to more convenient form. Or you can use x <- your.read.data[1,] y <- your.read.data[2,] to get x, y. Regards Petr > 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 > > -- > > ______________________________________________ > R-help@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. ______________________________________________ R-help@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.