Generic function that can be used to create and fetch the reference model structure for all those objects that have this method. All these implementations are wrappers to the init_refmodel-function so the returned object has the same type.

get_refmodel(object, ...)

# S3 method for refmodel
get_refmodel(object, ...)

# S3 method for vsel
get_refmodel(object, ...)

# S3 method for cvsel
get_refmodel(object, ...)

# S3 method for stanreg
get_refmodel(object, ...)

Arguments

object

Object based on which the reference model is created. See possible types below.

...

Arguments passed to the methods.

Value

An object of type refmodel (the same type as returned by init_refmodel) that can be passed to all the functions that take the reference fit as the first argument, such as varsel, cv_varsel, project, proj_predict and proj_linpred.

Examples

### Usage with stanreg objects fit <- stan_glm(y~x, binomial())
#> Error in stan_glm(y ~ x, binomial()): could not find function "stan_glm"
ref <- get_refmodel(fit)
#> Error in get_refmodel(fit): object 'fit' not found
print(class(ref))
#> Error in print(class(ref)): object 'ref' not found
# variable selection, use the already constructed reference model vs <- varsel(ref)
#> Error in get_refmodel(object, ...): object 'ref' not found
# this will first construct the reference model and then execute # exactly the same way as the previous command (the result is identical) vs <- varsel(fit)
#> Error in get_refmodel(object, ...): object 'fit' not found