survreg_map: Survival Regression with MAP

Description Usage Arguments Details Value


Fits a survival-regression model with MAP (Maximum a posteriori estimation).


survreg_map(formula, anc = NULL, data, distribution = "roy_parm_splines",
  dist_config = list(knots = NULL), na.action = na.exclude, priors = NULL,
  standardize_x = TRUE, contrasts = NULL, xlevels = NULL,
  optim_args = list(method = "BFGS", control = list(trace =
  as.integer(interactive()), maxit = 250)), predvars = NULL)



Formula, with both rhs and lhs, for the main parameter of the distribution.


A list of formulae, rhs only, named for other parameters of the distribution.


A data.frame


Character-string for distribution.


A list with options controlling the distribution.


Function for NAs


Either object resulting from set_prior (or a list of these), or a data.frame with columns 'parameter', 'term', 'family', 'location', 'spread'. An optional logical column 'fixed' can be used to specify parameters that should be fixed at their initial value and not updated during optimization. Note that priors are placed on the predictors *after* these predictors are centered and scaled, according to the standardize_x argument.


Either a logical specifying whether to center/scale numeric predictors, or a list with names 'center' and 'scale', each of which in turn are named numeric vectors specifying centering/scaling. Because priors are placed on the standardized scale, this is an important argument; see Details.


Contrasts that will determine how factors are formatted. Often the user doesn't want to use this argument, but instead it's useful for ‘update'. See ’Details' and ?update.survreg_map.


The levels for each factor (for when contrasts are not explicit). See ?update.survreg_map.


Arguments to pass to stats::optim


The 'predvars' attribute of a terms object. See ?update.survreg_map.


This function centers and scales all numeric predictors before the fitting process, and all priors are placed on this standardized scaled. There are some advantages to this. First, default-priors are meaningful and applicable for all numeric predictors: they can be interpreted as mean/expectation at no effect of each predictor, with a standard-deviation on this prior equal to the standard-deviation for that predictor. (For factors, you can set the contrasts to contr.full to acheive a similar effect.) Second, it's easy to set a single value for the 'spread' of the prior on all (non-intercept) predictors, which means it's easy to use priors for their regularization properties – e.g., trying different values for the 'spread' and picking the one that maximizes cross-validation performance. See crossv_loglik.

The disadvantage to standardizing the predictors is that a little more care is needed in preserving the standardization-parameters across model-calls. Default behavior for R's update function would recompute these parameters on each call: in this case it would mean refitting with new data (updating nothing else), which would have the side-effect of updating the prior (since updating the data would change the mean and standard-deviation of your predictors). This function avoids this unexpected behavior with the standardize_x, predvars, and contrasts arguments.

The standardize_x argument, if set to TRUE, will center and scale all numeric predictors. If a list specifying standardization-parameters is passed, then these will be used and not recomputed. The update method for survreg_map is smart enough to take advantage of this functionality: if only the data is being updated, it will make sure to replace the standardize_x=TRUE from the original call with standardize_x=[the parameters from the first call].

Some R transformation-functions perform standardization for you: for example, stats::scale or stats::poly (use methods(makepredictcall) to see them all). This function handles these by saving the 'predvars' attribute after the parameters are first computed. Just like standardize_x, the update method can then avoid re-computing these.

Finally, contr.full centers your contrast-codes based on the data it sees when first calling this function; if you call update, these contrasts will be preserved with the contrasts argument.


An object of type survreg_map

jwdink/survbayes documentation built on May 4, 2019, 4:23 p.m.