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 :: r count distinct dplyr 
R :: r make directory 
R :: convert string to lowercase R 
R :: remove first and last character from string R 
R :: r na if 
R :: how to summarise data but keep columns R 
R :: what is factor in r programming 
R :: table() in r 
R :: How to remove rows with inf from a dataframe in R 
R :: r dot product 
R :: replace character with na r 
R :: ggplot categorical data r 
R :: select a value in a data frame R 
R :: rstudio github upload 
R :: rstudio 
R :: correlation matrix using factors r 
R :: point estimates and prediction intervals in r 
R :: two letter country code in r 
R :: save link tweet in new column in R 
R :: rename vector in r 
R :: r install package 
Rust :: whats the difference between Iter and into_iter rust 
Rust :: how to make an array in rust 
Rust :: loop rust 
Rust :: armanriazi•rust•concept•superpowers 
Rust :: how to convert string to i32 in rust 
Rust :: rust•armanriazi•borrowchecker•borrow 
Rust :: rust multiplication table for a number 
Rust :: armanriazi•rust•concept•memoization•lazy•evaluation 
Rust :: armanriazi•rust•refactor•flowcontrol•match•unwrap_or_else 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =