Learn R Programming

OPSR (version 1.0.1)

opsr_step: Step Function for OPSR Model Fits

Description

Excludes all coefficients with p-values below pval and fits again.

Usage

opsr_step(object, pval, log = new.env(), .step = 1, ...)

Value

An object of class "opsr".

Arguments

object

an object of class "opsr".

pval

coefficients with p-values < pval are dropped.

log

environment to keep track of changes to object (in particular variables being eliminated). This could be useful in a function that repeatedly calls opsr_step internally in order to keep track of the full elimination history.

.step

used to generate identifier in log environment.

...

additional arguments passed to update (and hence opsr).

Examples

Run this code
sim_dat <- OPSR::opsr_simulate()
dat <- sim_dat$data
dat$xo3 <- runif(n = nrow(dat))
dat$xo4 <- factor(sample(c("level1", "leve2", "level3"), nrow(dat), replace = TRUE))
f <- ys | yo ~ xs1 + xs2 + log(xo3) | xo1 + xo2 + xo3 + xo4 | xo1 + xo2 + xo3 | xo1 + xo2
fit <- OPSR::opsr(f, dat, printLevel = 0)
fit_step <- opsr_step(fit, pval = 0.1)
texreg::screenreg(list(fit, fit_step))

Run the code above in your browser using DataLab