gasparrini / dlnm

R package dlnm
68 stars 13 forks source link

timeline on supporting `by = ` argument in smooth.construct.cb.smooth.spec? #6

Closed Aariq closed 3 years ago

Aariq commented 3 years ago

When using the "cb" basis in gam(), adding a by= argument gives the error:

Error in smooth.construct.cb.smooth.spec(object, dk$data, dk$knots) : 'by' argument not (yet) applicable with 'cb' smoother

This implies that someday the by argument will be applicable. Is this something being actively worked on? I'm asking because my current postdoc project involves modeling interactive effects of habitat (a factor with 2 levels) and (lagged, non-linear) drought. I think the DLNM approach is ideal, but I'm uncertain how to model the interaction without being allowed to use the by argument.

Is the implementation of the by argument primarily a programming issue or a mathematics issue? If it's a programming issue, I'd be interested in contributing. If it's a mathematics issue, I'm less confident that I can help!

gasparrini commented 3 years ago

Thanks, Eric.

The by argument would work for fitting the model, but then it makes difficult to predict the results with crosspred(), as these change depending on the interactive variable. It is possible to implement the change, but this would alter crosspred() considerably and I am not inclined to go for that route for such a specific change.

Best

Antonio Gasparrini, BSc Mbiol MSc PhD

Professor of Biostatistics and Epidemiology London School of Hygiene & Tropical Medicine 15-17 Tavistock Place, London WC1H 9SH, UK Office: 0044 (0)20 79272406 Mobile: 0044 (0)79 64925523 Skype: a.gasparrini Twitter: @AGasparrini75 http://www.ag-myresearch.com

From: Eric R Scott notifications@github.com Sent: 15 October 2020 22:43 To: gasparrini/dlnm dlnm@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: [gasparrini/dlnm] timeline on supporting by = argument in smooth.construct.cb.smooth.spec? (#6)

When using the "cb" basis in gam(), adding a by= argument gives the error:

Error in smooth.construct.cb.smooth.spec(object, dk$data, dk$knots) : 'by' argument not (yet) applicable with 'cb' smoother

This implies that someday the by argument will be applicable. Is this something being actively worked on? I'm asking because my current postdoc project involves modeling interactive effects of habitat (a factor with 2 levels) and (lagged, non-linear) drought. I think the DLNM approach is ideal, but I'm uncertain how to model the interaction without being allowed to use the by argument.

Is the implementation of the by argument primarily a programming issue or a mathematics issue? If it's a programming issue, I'd be interested in contributing. If it's a mathematics issue, I'm less confident that I can help!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/gasparrini/dlnm/issues/6, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADHVOGRQRSV5PFMYLIXEJN3SK5NFJANCNFSM4SSPK5KA.