有没有办法在GLM中扩展所有变量*,包括交互变量?例如,当我缩放所有单个变量而不是交互时,运行模型是有效的。
这有效:
mod_lm_scale <-glm( pa ~
scale(WC05) + scale(WC06) + scale(WC08) +
scale(WC13) + scale(WC15),
data=sdmdata,
family='binomial')
尝试添加缩放交互不起作用。见最后一项:比例(WC05:WC06)
mod_lm_scale <-glm( pa ~
scale(WC05) + scale(WC06) + scale(WC08) +
scale(WC13) + scale(WC15),
scale(WC05:WC06),
data=sdmdata,
family='binomial')
在包含缩放交互时收到此错误,并且在我不包含错误时收到错误:
Error in model.frame.default(formula = pa ~ scale(WC05_clipped) + scale(WC06_clipped) + :
variable lengths differ (found for '(weights)')
In addition: Warning messages:
1: In WC05_clipped:WC06_clipped :
numerical expression has 2869 elements: only the first used
2: In WC05_clipped:WC06_clipped :
numerical expression has 2869 elements: only the first used