egr95 / R-codacore

An R package for learning log-ratio biomarkers from high-throughput sequencing data.
Other
21 stars 3 forks source link

covariate adjustment with continuous outcome #15

Closed nick-youngblut closed 1 year ago

nick-youngblut commented 2 years ago

Given that one would not use glm(family='binomial') for a continuous outcome, it would be helpful to include a code snippet as in:

xTest <- x[-trainIndex,]
yTest <- z[-trainIndex]
yHatLogit <- predict(partial, newdata = dfTest) + predict(model, xTest, logits=T)
yHat <- yHatLogit > 0 # in case we need binary predictions e.g. to compute accuracy
testAUC <- pROC::auc(pROC::roc(yTest, yHatLogit, quiet=T))
cat("Test AUC:", round(100 * testAUC), "%")

...but for continuous outcomes

egr95 commented 2 years ago

Good idea, thanks. Have added in such a snippet, let me know if anything is unclear.