ggeffects icon indicating copy to clipboard operation
ggeffects copied to clipboard

ggeffect error when model has periodic splines

Open Kasi21 opened this issue 3 years ago • 2 comments

When I attempt to get estimated marginal means (using function ggeffect) from a model containing periodic splines, I get the error

Error in `[.data.frame`(md, , needed.vars, drop = FALSE) : 
  undefined columns selected

However, the exact same model formulation, but with natural splines used instead of periodic splines works perfectly.

Periodic splines model:

glmmTMB(movement_distance ~ mSpline(hour, df = 4) + 
                      max_temp24 + mSpline(hour, df = 4)*max_temp24 + 
                      ou(hour_fc-1|date_fc) + (1|ID), 
                    data=data) 

Natural splines model:

glmmTMB(movement_distance ~ ns(hour, df = 4) + 
                      max_temp24 + ns(hour, df = 4)*max_temp24 + 
                      ou(hour_fc-1|date_fc) + (1|ID), 
                    data=model_df_new3) 

Is this a bug that you could fix, or do you know why this is happening and how I can fix myself?

Thanks in advance.

Kasi21 avatar Aug 21 '21 19:08 Kasi21

Do you have a small reproducible example?

strengejacke avatar Sep 22 '21 11:09 strengejacke

bump

strengejacke avatar Aug 16 '22 10:08 strengejacke