Skip to content

Commit

Permalink
clean up code for lm
Browse files Browse the repository at this point in the history
  • Loading branch information
HannaMeyer committed Mar 13, 2024
1 parent e7774e0 commit b06fe0e
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions R/errorProfiles.R
Original file line number Diff line number Diff line change
Expand Up @@ -179,16 +179,12 @@ errorModel <- function(preds_all, model, window.size, calib, k, m, variable){
performance$ul <- data.table::shift(performance[,variable],-round(window.size/2),0)
performance <- performance[!is.na(performance$metric),]

performance <- performance[,c(variable,"metric")]
### Estimate Error:
if(calib=="lm"){
if (variable == "DI") {
errormodel <- lm(metric ~ DI, data = performance)
} else if (variable == "LPD") {
errormodel <- lm(metric ~ LPD, data = performance)
} else if (variable=="geodist"){
errormodel <- lm(metric ~ geodist, data = performance)
}
errormodel <- lm(metric ~ ., data = performance)
}

if(calib=="scam"){
if (!requireNamespace("scam", quietly = TRUE)) {
stop("Package \"scam\" needed for this function to work. Please install it.",
Expand Down

0 comments on commit b06fe0e

Please sign in to comment.