Perform projection onto submodels of selected sizes or a specified feature combination.

project(object, nv = NULL, vind = NULL, relax = NULL, ns = NULL,
  nc = NULL, intercept = NULL, seed = NULL, regul = 1e-04, ...)



Either a refmodel-type object created by get_refmodel or init_refmodel, or an object which can be converted to a reference model using get_refmodel.


Number of variables in the submodel (the variable combination is taken from the varsel information). If a list, then the projection is performed for each model size. Default is the model size suggested by the variable selection (see function suggest_size). Ignored if vind is specified.


Variable indices onto which the projection is done. If specified, nv is ignored.


If TRUE, then the projected coefficients after L1-selection are computed without any penalization (or using only the regularization determined by regul). If FALSE, then the coefficients are the solution from the L1-penalized projection. This option is relevant only if L1-search was used. Default is TRUE for genuine reference models and FALSE if object is datafit (see init_refmodel).


Number of samples to be projected. Ignored if nc is specified. Default is 400.


Number of clusters in the clustered projection.


Whether to use intercept. Default is TRUE.


A seed used in the clustering (if nc!=ns). Can be used to ensure same results every time.


Amount of regularization in the projection. Usually there is no need for regularization, but sometimes for some models the projection can be ill-behaved and we need to add some regularization to avoid numerical problems.


Currently ignored.


A list of submodels (or a single submodel if projection was performed onto a single variable combination), each of which contains the following elements:


The kl divergence from the reference model to the submodel.


Weights for each draw of the projected model.


Draws from the projected dispersion parameter.


Draws from the projected intercept.


Draws from the projected weight vector.


The order in which the variables were added to the submodel.


Whether or not the model contains an intercept.


A modified family-object.


### Usage with stanreg objects fit <- stan_glm(y~x, binomial())
#> Error in stan_glm(y ~ x, binomial()): could not find function "stan_glm"
vs <- varsel(fit)
#> Error in get_refmodel(object, ...): object 'fit' not found
# project onto the best model with 4 variables proj4 <- project(vs, nv = 4)
#> Error in "vsel" %in% class(object): object 'vs' not found
# project onto an arbitrary variable combination (variable indices 3,4 and 8) proj <- project(fit, vind=c(3,4,8))
#> Error in "vsel" %in% class(object): object 'fit' not found