Dear climwin team,
Firstly, thank you for creating and maintaining this very useful package for climate window analysis.
I am encountering a problem when using slidingwin() with a binomial GLM, where my response is proportional breeding success (successes and failures). According to the documentation, slidingwin supports general GLMs, but I receive the following error:
Error in basewin(exclude = exclude, xvar = xvar[[paste(allcombos[combo, :
NA values present in biological response. Please remove NA values
However, my input data frames do not contain any NA values in the response or predictors, and a baseline binomial GLM runs fine outside of slidingwin. This suggests the error arises from internal data handling or windowing, not my input data.
Minimal example structure:
# Baseline model (works)
baseline_glm <- glm(cbind(successes, failures) ~ 1, family = binomial, data = mydata)
# This triggers the error:
output <- slidingwin(
xvar = list(myclimatevar = climate_data$variable),
cdate = climate_data$date,
bdate = mydata$date,
baseline = baseline_glm,
cohort = mydata$cohort,
cinterval = "day",
range = c(182, 0),
type = "relative",
stat = "sum",
func = "lin"
)
Additional context
- The documentation indicates that
slidingwin accepts general GLMs, but in practice it does not seem to work with binomial family models.
- If I run the same analysis with proportional response data (bounded between 0 and 1) using a gaussian error in the GLM, the
slidingwin function works fine.
- However, for such proportional data, a binomial family is more accurate and appropriate to use, yet the
slidingwin function does not let me proceed with it.
- I would greatly appreciate any guidance or a workaround to enable binomial GLMs for proportional data in
slidingwin, or clarification if there is a current limitation.
What I have checked:
- No NA values in input data
- All date ranges and classes are aligned
- No duplicates, no zero or negative values, all responses valid for binomial GLM
- GLM works fine outside slidingwin
Expected behavior
I was hoping that slidingwin would run with binomial GLMs as documented, or else clarify any limitations or provide a recommended workaround.
Session info
- R version: 4.5.0
- climwin version: 1.2.3
- Platform: Windows
Thank you very much for your help and for developing climwin!
Dear climwin team,
Firstly, thank you for creating and maintaining this very useful package for climate window analysis.
I am encountering a problem when using
slidingwin()with a binomial GLM, where my response is proportional breeding success (successes and failures). According to the documentation,slidingwinsupports general GLMs, but I receive the following error:However, my input data frames do not contain any NA values in the response or predictors, and a baseline binomial GLM runs fine outside of
slidingwin. This suggests the error arises from internal data handling or windowing, not my input data.Minimal example structure:
Additional context
slidingwinaccepts general GLMs, but in practice it does not seem to work with binomial family models.slidingwinfunction works fine.slidingwinfunction does not let me proceed with it.slidingwin, or clarification if there is a current limitation.What I have checked:
Expected behavior
I was hoping that
slidingwinwould run with binomial GLMs as documented, or else clarify any limitations or provide a recommended workaround.Session info
Thank you very much for your help and for developing
climwin!