inst/doc/coarsening.R

## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

## ----setup--------------------------------------------------------------------
library(smcfcs)
summary(ex_coarsening)
head(ex_coarsening)

## -----------------------------------------------------------------------------
table(ex_coarsening$x,ex_coarsening$xobs,useNA = "ifany")

## -----------------------------------------------------------------------------
restrictionsX = c("xobs = a/c ~ a + c",
                  "xobs = b/c ~ b + c")
restrictions = append(list(restrictionsX), as.list(c("", "", "")))

## ----results=FALSE, warning=FALSE---------------------------------------------
set.seed(68204812)
imps <- smcfcs(originaldata=ex_coarsening,
               smtype="lm",
               smformula = "y~z+x",
               method = c("mlogit","", "", ""),
               restrictions = restrictions
)

## -----------------------------------------------------------------------------
head(imps$impDatasets[[1]])

## -----------------------------------------------------------------------------
table(imps$impDatasets[[1]]$x,imps$impDatasets[[1]]$xobs,useNA = "ifany")

Try the smcfcs package in your browser

Any scripts or data that you put into this service are public.

smcfcs documentation built on April 4, 2025, 1:58 a.m.