# Note we use here a very small example data set to expedite examples.
# load toy dataset
data("CNVCOVY")
# prepare data format for regression analysis
## Continuous outcome Y_QT
frag_data <- prep(CNV = CNV, Y = Y_QT, Z = Cov, rare.out = 0.05)
QT_fit <- fit_WTSMTH(frag_data,
lambda1 = -5,
lambda2 = 21,
weight = "eql",
family = "gaussian")
## Binary outcome Y_BT
# We can directly replace frag_data$Y with Y_BT in the correct format,
# ensuring that the ordering matches that of the prepared object.
rownames(Y_BT) <- Y_BT$ID
frag_data$Y <- Y_BT[names(frag_data$Y), "Y"] |> drop()
names(frag_data$Y) <- rownames(frag_data$Z)
# Or, we can also repeat the prep() call
# frag_data <- prep(CNV = CNV, Y = Y_BT, Z = Cov, rare.out = 0.05)
BT_fit <- fit_WTSMTH(frag_data,
lambda1 = -5,
lambda2 = 6,
weight = "eql",
family = "binomial")
Run the code above in your browser using DataLab