prepare: Prepare the model for analysis.

View source: R/prepare.R

prepareR Documentation

Prepare the model for analysis.

Description

Prepare the model for analysis.

Usage

prepare(
  x,
  intercept,
  prior.mean,
  prior.sd,
  prior.scale,
  prior.df,
  group,
  multinomial = FALSE,
  outcome.cats = NULL
)

Arguments

x

The design, or input, matrix, of dimension nobs x nvars; each row is an observation vector.

intercept

Logical. When intercept = TRUE, an intercept is included in the model.

prior.mean

A vector of prior means for the parameters. If length(prior.mean) = 1, then all parameters are assumed to have a common prior mean.

prior.sd

A vector defining prior standard deviations in the normal priors of the coefficients. If provided, they are starting values of the prior standard deviations for the iterative algorithms. This argument is used within the function bglm().If length(prior.sd) = 1, then all parameters are assumed to have a common prior standard deviation.

prior.scale

A vector containing the prior scale values for double exponential or t prior. In the spike-and-slab lasso model, this is generally only the slab prior scale.

prior.df

A scalar defining the prior degrees of freedom when the t-distribution is used as a prior for the parameters.

group

A numeric vector, or an integer, or a list indicating the groups of predictors. If group = NULL, all the predictors form a single group. If group = K, the predictors are evenly divided into groups each with K predictors. If group is a numberic vector, it defines groups as follows: Group 1: (group[1]+1):group[2], Group 2: (group[2]+1):group[3], Group 3: (group[3]+1):group[4], ... If group is a list of variable names, group[[k]] includes variables in the k-th group. The mixture double-exponential prior is only used for grouped predictors. For ungrouped predictors, the prior is double-exponential with scale ss[2] and mean 0.

multinomial

Logical. When TRUE, prepare the data for analysis of multinomial outcome according to parameterization in glmnet, i.e., a unique set of parameters is associated with each outcome category. See section 4 of \insertCiteFriedman:2010ssnet for details.

outcome.cats

Either an integer denoting the number of response categories, or a vector containing outcome categories. Only used when multinomial = TRUE.

Value

A list containing necessary elements for Bayesian analysis in the package BhGLM.

Note

This function is a modified version the function prepare from the R package BhGLM.

References

\insertRef

Friedman:2010ssnet


jmleach-bst/ssnet documentation built on March 4, 2024, 5:04 p.m.