## load the data, which are contained in the package
data(drops_GE)
data(drops_GnE)
## We remove identifiers that we don't need.
drops_GE_GnE <- rbind(drops_GE[, -c(2, 4)], drops_GnE[, -c(2, 4)])
## Define indeces.
ind <- colnames(drops_GE)[13:23]
## Define test environments.
testenv <- levels(drops_GnE$Experiment)
## Additive model, only main effects (set the penalty parameter to a large value).
Additive_model <- GnE(drops_GE_GnE, Y = "grain.yield", lambda = 100000,
G = "Variety_ID", E = "Experiment", testEnv = testenv,
indices = ind, penG = FALSE, penE = FALSE,
alpha = 0.5, scaling = "train")
# \donttest{
## Full model, no penalization (set the penalty parameter to zero).
Full_model <- GnE(drops_GE_GnE, Y = "grain.yield", lambda = 0,
G = "Variety_ID", E = "Experiment", testEnv = testenv,
indices = ind, penG = FALSE, penE = FALSE,
alpha = 0.5, scaling = "train")
## Elastic Net model, set alpha parameter to 0.5.
Elnet_model <- GnE(drops_GE_GnE, Y = "grain.yield", lambda = NULL,
G = "Variety_ID", E = "Experiment", testEnv = testenv,
indices = ind, penG = FALSE, penE = FALSE,
alpha = 0.5, scaling = "train")
## Lasso model, set alpha parameter to 1.
Lasso_model <- GnE(drops_GE_GnE, Y = "grain.yield", lambda = NULL,
G = "Variety_ID", E = "Experiment", testEnv = testenv,
indices = ind, penG = FALSE, penE = FALSE,
alpha = 1, scaling = "train")
## Ridge model, set alpha parameter to 0.
Ridge_model <- GnE(drops_GE_GnE, Y = "grain.yield", lambda = NULL,
G = "Variety_ID", E = "Experiment", testEnv = testenv,
indices = ind, penG = FALSE, penE = FALSE,
alpha = 0, scaling = "train")
# }
Run the code above in your browser using DataLab