[R] lm

Yuan Jian jayuan2008 at yahoo.com
Sun Feb 21 02:27:52 CET 2016


Hello,I used l  to draw a figure, but I got different result (26 vs 301) when I input the same parameters.

> length(predict(lm(A$Counts ~ AT),list(ATE=timevalues)))
[1] 26
> length(predict(lm(A$Counts ~ ATE),list(ATE=timevalues)))
[1] 301

all variables are initialized as below:
>A <- structure(list(Time = c(0, 1, 2, 4, 6, 8, 9, 10, 11, 12, 13, 
 14, 15, 16, 18, 19, 20, 21, 22, 24, 25, 26, 27, 28, 29, 30), 
 Counts = c(126.6, 101.8, 71.6, 101.6, 68.1, 62.9, 45.5, 41.9, 
 46.3, 34.1, 38.2, 41.7, 24.7, 41.5, 36.6, 19.6, 
 22.8, 29.6, 23.5, 15.3, 13.4, 26.8, 9.8, 18.8, 25.9, 19.3)), .Names = c("Time", "Counts"),
 row.names = c(1L, 2L, 3L, 5L, 7L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 19L, 20L, 21L, 22L, 23L, 25L, 26L, 27L, 28L, 29L, 30L, 31L),
 class = "data.frame")
>timevalues <- seq(0, 30, 0.1)
>AT<-A$Time>ATE<-A$Time
	[[alternative HTML version deleted]]



More information about the R-help mailing list