Skip to main content
2 of 2
edited tags
Sextus Empiricus
  • 86.5k
  • 6
  • 115
  • 302

Problematic data for regression model

This is a follow-up question to Which model for my data? (testing the differences in slope for three groups).

The solution from there works (big thanks to Heteroskedastic Jim!), but I have a problem with a specific data set. Maybe someone can enlighten me why I get stuck.

Here is an example that works:

library(nlme)
library(emmeans)

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)

This constructs the model:

(m1 <- gls(Size ~ Time * Group, dat, correlation = corAR1(form = ~ Time | Group), weights = varIdent(form = ~ 1 | I(Group == "A"))))

And this provides me with the p-values for slope differences:

pairs(emtrends(m1, ~ Group, var = "Time", df = Inf, options = get_emm_option("emmeans")))

Now the data set where I get stuck:

Input = ("
Group   Time    Size
         A  1   1.6210
         A  2   2.1118
         A  3   2.6026
         A  4   3.0934
         B  1   0.9162
         B  2   1.2122
         B  3   1.5082
         B  4   1.8042
         B  5   2.1002
         B  6   2.3962
         B  7   2.6922
         B  8   2.9882
         B  9   3.2842
         B  10  3.5802
         C  1   0.82701
         C  2   1.13441
         C  3   1.44181
         C  4   1.74921
         C  5   2.05661
         C  6   2.36401
         C  7   2.67141
         C  8   2.97881
         C  9   3.28621
         C  10  3.59361
         ")
dat = read.table(textConnection(Input),header=TRUE)

When I construct the above model with this specific data

(m1 <- gls(Size ~ Time * Group, dat, correlation = corAR1(form = ~ Time | Group), weights = varIdent(form = ~ 1 | I(Group == "A"))))

I get this error message:

Error in glsEstimate(object, control = control) : computed "gls" fit is singular, rank 6

I have tried analyzing the data in SPSS, but I also got stuck there.

So my question is: where is the problem with my data and what can I do to solve it?