The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

svyVarSel

This package allows to fit linear and logistic LASSO and elastic net models to complex survey data.

This package depends on survey and glmnet packages.

Five functions are available in the package:

Installation

To install it from CRAN:

install.packages("svyVarSel")

To install the updated version of the package from GitHub:

devtools::install_github("aiparragirre/svyVarSel")

Example

Fit a logistic elastic net model as follows:

library(svyVarSel)
data(simdata_lasso_binomial)

mcv <- welnet(data = simdata_lasso_binomial,
              col.y = "y", col.x = 1:50,
              family = "binomial",
              alpha = 0.5,
              cluster = "cluster", strata = "strata", weights = "weights",  
              method = "dCV", k=10, R=20)

Or equivalently:

mydesign <- survey::svydesign(ids=~cluster, strata = ~strata, weights = ~weights,
                              nest = TRUE, data = simdata_lasso_binomial)
mcv <- welnet(col.y = "y", col.x = 1:50, design = mydesign,
              family = "binomial", alpha = 0.5,
              method = "dCV", k=10, R=20)

Then, plot the result as follows:

welnet.plot(mcv)

If you only aim to obtain replicate weights for other purposes, use the replicate.weights() function:

newdata <- replicate.weights(data = simdata_lasso_binomial,
                             method = "dCV",
                             cluster = "cluster",
                             strata = "strata",
                             weights = "weights",
                             k = 10, R = 20,
                             rw.test = TRUE)

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.