[R] conditional regression with mgcv
deanforce14 at gmail.com
Fri Mar 31 17:58:10 CEST 2017
As a part of a larger project, I am trying to run a conditional logistic
regression to look at whether maternal age is implicated in the risk of
developing gestational diabetes. I am using a matched case-control design,
where mothers with GDM were individually matched with up to 6 controls
based on several parameters.
I run the following model:
model <- gam(gdm ~ s(maternal_age, bs="cr") + strata(risk_set) +
as.factor(district) + as.factor(riskfactor1)+as.factor(riskfactor2), data =
dt, family=cox.ph(), weights = wt)
weights are defined as 0 for censoring, 1 for event, and each subject has
one event/censoring time and one row of covariate values. In total there
are 1000 cases, matched to 5500 controls, so there are 1000 risk_set that I
define as strata.
When running the model, I keep getting the following error: “Error in
xat[[i]] : subscript out of bounds”. Am I doing something wrong?
[[alternative HTML version deleted]]
More information about the R-help