margie
margie

Reputation: 21

warning: non-list contrasts argument ignored

I am running a gamm using the 'mgcv' package in R:

additive.model.saturated <- gamm(log.titer ~ condition + 
                            Age_month_selective + Season.2 +
                            s(capture.month, bs = "cc", k = 12) +
                            s(capture.year, bs = "ps", k = 5),
                            random=list(Animal.ID=~1), data = data)

However, I keep getting the warning message below. I can not seem to figure out why I am getting this warning and how to adjust my analysis to resolve any mistakes the warning is suggesting I need to fix.

Warning message:
In model.matrix.default(~b$groups[[n.levels - i + 1]] - 1, contrasts.arg = c("contr.treatment",  :
  non-list contrasts argument ignored

A summary and subset of the data is included below:

#summary:
'data.frame':   1263 obs. of  6 variables:
 $ log.titer          : num  0 0 0 0 0 ...
 $ condition          : num  5 3.5 3.75 3.25 4 3.5 3.25 2.5 3.25 2.75 ...
 $ Age_month_selective: int  39 57 63 68 75 83 27 44 39 51 ...
 $ Season.2           : Factor w/ 2 levels "dry","wet": 1 2 1 2 1 2 1 2 1 1 ...
 $ capture.month      : int  6 12 6 11 6 2 6 11 6 6 ...
 $ capture.year       : int  2008 2009 2010 2010 2011 2012 2008 2009 2009 2010 ...

#data subset
   log.titer condition Age_month_selective Season.2 capture.month capture.year Animal.ID
1   0.000000      5.00                  39      dry             6         2008        B1
2   0.000000      3.50                  57      wet            12         2009        B1
3   0.000000      3.75                  63      dry             6         2010        B1
4   0.000000      3.25                  68      wet            11         2010        B1
5   0.000000      4.00                  75      dry             6         2011        B1
6   1.447158      3.50                  83      wet             2         2012        B1
7   1.334454      3.25                  27      dry             6         2008       B10
8   0.000000      2.50                  44      wet            11         2009       B10
9   0.000000      3.25                  39      dry             6         2009       B10
10  0.000000      2.75                  51      dry             6         2010       B10
11  0.000000      2.50                  56      wet            11         2010       B10
12  0.000000      2.00                  63      dry             6         2011       B10
13  0.000000      2.50                  71      wet             2         2012       B10
14  0.000000      4.50                  63      dry             6         2008       B11
15  1.363612      3.75                  80      wet            11         2009       B11
16  1.365488      4.75                  76      dry             7         2009       B11
17  0.000000      3.75                  87      dry             6         2010       B11
18  0.000000      4.00                  95      wet             2         2011       B11
19  1.447158      3.25                  99      dry             6         2011       B11
20  0.000000      4.75                  51      dry             6         2008       B12
21  0.000000      4.25                  68      wet            11         2009       B12
22  0.000000      4.25                  68      wet            11         2009       B12
23  0.000000      3.50                  75      dry             6         2010       B12
24  0.000000      3.75                  80      wet            11         2010       B12
25  1.414973      2.00                  92      wet            11         2011       B12

Upvotes: 2

Views: 2475

Answers (1)

user101089
user101089

Reputation: 3992

I got a similar warning from work on a function for ridge regression in my genridge package. It turned out that had not accounted for factors properly. The warning message has to do with your factor variable, Season.2.

I don't see anything in ?mgcv::gamm about factors. It is possible that this is a problem better addressed by filing an issue with mgcv.

Upvotes: 0

Related Questions