I have this data:
Group Time Size
A 1 0.56
A 2 0.97
A 3 1.33
A 4 1.75
B 1 0.12
B 2 0.24
B 3 0.31
B 4 0.47
B 5 0.51
B 6 0.69
B 7 0.73
B 8 0.85
C 1 0.16
C 2 0.23
C 3 0.38
C 4 0.49
C 5 0.53
C 6 0.66
C 7 0.78
C 8 0.81
Here is the respective plot:
Now I would like to test the three groups for differences in slope and intercept. I cannot use simple linear regression since these are time series and the data points are not independent of each other.
Here are the additional tests I performed on the linar model:
Data = read.table(textConnection(Input),header=TRUE)
model = lm(Size ~ Time + Group,data = Data)
Shapiro-Wilk test for normality:
shapiro.test(residuals(model))
p=0.001288 (not normally distributed)
Breusch-Pagan test for equal variances:
bptest(model)
p=0.016 (variances not equal)
Since residuals are not normally distributed and variances are not equal an ANOVA (for example) could not be performed. Furthermore, the residuals are auto-correlated according to the Durbin-Watson test:
dwtest(model)
p=0.001065 (data points auto-correlated)
Which model would be suitable for my problem (probably a multilevel linear model?) and which R packages I could use for the analysis?
Another data set:
Input = ("
Group Time Size
A 1 1.08152
A 2 1.10589
A 3 1.13292
B 1 1.04597
B 2 1.05763
B 3 1.07023
B 4 1.08612
B 5 1.10059
B 6 1.11589
B 7 1.13143
B 8 1.14741
B 9 1.16721
B 10 1.18288
C 1 1.04777
C 2 1.06145
C 3 1.07484
C 4 1.08908
C 5 1.10346
C 6 1.11866
C 7 1.13375
C 8 1.14931
C 9 1.16563
C 10 1.18294
")
dat = read.table(textConnection(Input),header=TRUE)