Skip to content

Commit

Permalink
fix factors for regression
Browse files Browse the repository at this point in the history
  • Loading branch information
agosiewska committed Feb 27, 2018
1 parent db09eb1 commit 1757c6e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions R/calculateResiduals.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ getResiduals <- function(model, y, data, predict.function){
if (!is.null(model$type) && model$type == "classification") {
res <- 1 - predict.function(model, data)[cbind(1:nrow(data),y)]
} else {
if(is.factor(y)) y <- as.numeric(y) - 1
res <- y - predict(model, type = "response", newdata = data)
}

Expand Down

0 comments on commit 1757c6e

Please sign in to comment.