aicreg {glmnetr} | R Documentation |
Identify model based upon AIC criteria from a stepreg() putput
Description
Identify model based upon AIC criteria from a stepreg() putput
Usage
aicreg(
xs,
start,
y_,
event,
steps_n = steps_n,
family = family,
object = NULL,
track = 0
)
Arguments
xs |
predictor input - an n by p matrix, where n (rows) is sample size, and p (columns) the number of predictors. Must be in matrix form for complete data, no NA's, no Inf's, etc., and not a data frame. |
start |
start time, Cox model only - class numeric of length same as number of patients (n) |
y_ |
output vector: time, or stop time for Cox model, y_ 0 or 1 for binomial (logistic), numeric for gaussian. Must be a vector of length same as number of sample size. |
event |
event indicator, 1 for event, 0 for census, Cox model only. Must be a numeric vector of length same as sample size. |
steps_n |
maximum number of steps done in stepwise regression fitting |
family |
model family, "cox", "binomial" or "gaussian" |
object |
A stepreg() output. If NULL it will be derived. |
track |
Indicate whether or not to update progress in the console. Default of 0 suppresses these updates. The option of 1 provides these updates. In fitting clinical data with non full rank design matrix we have found some R-packages to take a very long time or possibly get caught in infinite loops. Therefore we allow the user to track the package and judge whether things are moving forward or if the process should be stopped. |
Value
The identified model in form of a glm() or coxph() output object, with an entry of the stepreg() output object.
See Also
stepreg
, cv.stepreg
, nested.glmnetr
Examples
set.seed(18306296)
sim.data=glmnetr.simdata(nrows=100, ncols=100, beta=c(0,1,1))
# this gives a more intersting case but takes longer to run
xs=sim.data$xs
# this will work numerically
xs=sim.data$xs[,c(2,3,50:55)]
y_=sim.data$yt
event=sim.data$event
cox.aic.fit = aicreg(xs, NULL, y_, event, family="cox", steps_n=40)
summary(cox.aic.fit)
y_=sim.data$yt
norm.aic.fit = aicreg(xs, NULL, y_, NULL, family="gaussian", steps_n=40)
summary(norm.aic.fit)