I’m trying to use bam() and method=”fREML” to speed up my analyses.
mode11 <- bam(Met1 ~ s(Timepoint, k=7) + s(Timepoint, by=subject, k=7) + s(subject, bs="re"), data=df, method="REML")
model2 <- bam(Met1 ~ s(Timepoint, k=7) + s(Timepoint, by=subject, k=7, m=1) + s(subject, bs="re"), data=df, method="REML")
I noticed the models above run, but when I try and get a summary for model2, I get the following error
Error in h(simpleError(msg, call)) :
error in evaluating the argument 'x' in selecting a method for function 'chol': non-conformable arrays
Why might this be (m=1 is affecting it, but not sure why the above error)? A summary of a gam() with m=1 works fine.
EDIT: cannot find another example where this applies, so presume its data specific. But not sure how to assess model2 output to understand why summary(model2) doesn’t work. dput(df) below.
structure(list(subject = structure(c(1L, 1L, 1L, 1L, 1L, 1L,
1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 6L, 6L, 6L,
6L, 6L, 6L, 6L, 7L, 7L, 7L, 7L, 7L, 7L, 7L), levels = c("1",
"3", "4", "5", "6", "7", "8", "10", "11", "12", "16", "17", "19",
"21", "22", "25", "26", "28", "35", "36", "37", "38", "39", "40",
"42", "43", "44", "45", "46", "48", "50", "51", "52", "55", "56",
"57", "58", "61", "65", "71"), class = "factor"), Timepoint = c(1L,
2L, 3L, 4L, 5L, 6L, 7L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 1L, 2L, 3L,
4L, 5L, 6L, 7L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 1L, 2L, 3L, 4L, 5L,
6L, 7L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 1L, 2L, 3L, 4L, 5L, 6L, 7L
), Met1 = c(0.012461309, 0.01794298, 0.003863203, -0.006398583,
0.001760362, 0.000870293, 0.000830637, -0.014258656, -0.01946732,
0.00389311, 0.000199752, -0.0122629, 0.007792022, 0.007019363,
0.006641794, 0.012690831, 0.004881705, -0.004663227, 0.002341043,
-0.008827367, -0.009172269, 0.038058982, -0.002204742, -0.003488286,
0.004832194, -0.00137924, -0.016501518, 0.006870124, 0.011860637,
0.005993393, -0.004560137, -0.007139575, 0.000783146, 0.026054272,
0.000494855, 0.008204079, -0.011764013, -0.006389326, 0.008017244,
0.004591451, 0.012983199, 0.010973351, 0.005136924, 0.014092113,
0.002394753, 0.022453531, 0.012407455, 0.001519177, 0.000155242
)), row.names = c(NA, 49L), class = "data.frame")