devtools::install_github("CRG180/NPSOR")
These also work with a fit object from tidymodels $fit
Root Mean Square Error RMSE(x)
x can be a lm
object or a numeric vector of residuals
Mean Square Error MSE(x)
x can be a lm
object or a numeric vector of residuals
Mean Absolute Error MAE(x)
x can be a lm
object or a numeric vector of residuals
split_df(df, p = .8)
df
= a dataframe, p
= proportion to be training data. Output is list with two data frames: $train
and$test
library(NPSOR)
mtcars2 <-split_df(mtcars,.8)
train_model <- lm(mpg~., mtcars2$train)
test <- predict(train_model, mtcars2$test)
error <- (test-mtcars2$test$mpg)
test_model <-lm(mpg~., mtcars2$train)
RMSE(train_model) # Training RMSE
RMSE(error) #Test RMSE
`