Search
 
SCRIPT & CODE EXAMPLE
 

R

calculating RMSE, Rsquared with caret in R

library(caret)
# datasets:
original = c( -2,  1, -3, 2, 3, 5, 4, 6, 5, 6, 7)
predicted = c(-1, -1, -2, 2, 3, 4, 4, 5, 5, 7, 7)

# caret package functions 
RMSE(predicted, original)
R2(predicted, original, form = "traditional")
[1] 0.904534
Comment

calculating RMSE, MAE, MSE, Rsquared manually in R

d = original-predicted
mse = mean((d)^2)
mae = mean(abs(d))
rmse = sqrt(mse)
R2 = 1-(sum((d)^2)/sum((original-mean(original))^2))

cat(" MAE:", mae, "
", "MSE:", mse, "
",
Comment

PREVIOUS NEXT
Code Example
R :: mean in r 
R :: get matrix row name r 
R :: how to throw an error in R 
R :: what is a vector in r 
R :: moving average in r 
R :: How to remove rows with inf from a dataframe in R 
R :: how to wait for a key press in R 
R :: how to tell if a variable is discrete or continuous in r 
R :: autoplot confusion matrix 
R :: r for loop 
R :: insert character into string 
R :: read delim in r with lapply read.delim sep 
R :: What does | mean in r 
R :: how to make date column index in R 
R :: how to set a dataframe as a value in a list in r 
R :: dplyr to vector 
R :: find sys date in R 
R :: convert ratio to numeric in r 
R :: barplot_density 
Rust :: rust reverse range 
Rust :: how to create a string of n characters rust 
Rust :: How to know the data type in rust 
Rust :: read line rust 
Rust :: armanriazi•rust•concept•superpowers 
Rust :: rustlang char array 
Rust :: armanriazi•rust•unsafe•extern 
Rust :: rust comments 
Rust :: rust print i8 
Rust :: armanriazi•rust•error•[E0072]: recursive type `List` has infinite size -- src/main.rs:3:1 | 3 | enum List { | ^^^^^^^^^ recursive type has infinite size 
Lua :: lua string.split 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =