lasso: Use a LASSO algorithm to find important predictors

Description Usage Arguments Value Examples

View source: R/dyadmlvar.R

Description

lasso Function that uses the LASSO shrinkage reduction method to find meaningful predictors of an outcome vector

Usage

1
2
lasso(Data, Predictors, Outcome, Seeds = 1, Train = F,
  PropOfTrain = 0.75, Plot = F)

Arguments

Data

a dataframe with columns for each predictor and for the outcome variable

Predictors

a list of strings with predictor variables names

Outcome

a string with the name of an outcome variable

Seeds

a seed for randomly selecting some part of the data to be training data and some to be testing data. default -

Train

Should we split data to training and test datasets (FALSE uses all data for both)

PropOfTrain

How much of the data to use for training the model

Plot

shoud we show a plot of the parameter number and log likelihood?

Value

a list of estimates for the effect of the valid predictors, and a R^2 statistic for the final model

Examples

1
2
3
4
5
ntwrk <- read_network(fit1)
#intra-partner variables from the partner B
intra_B_vars <- get_names(ntwrk, part = INTRA_B, time = ALL_NETWORK)
full_data <- merge(ntwrk$all, sat, by = "ID", all=TRUE, sort=TRUE)
lasso(full_data, intra_B_vars, "W_csi_resid")

haranse/dyadmlvar documentation built on May 23, 2019, 6:06 p.m.