(This article was first published on

**NIR-Quimiometría**, and kindly contributed to R-bloggers)I´ve been practicing after reading a couple of tutorials:

to create a basic function to monitor some basic statistics as RMSEP, Bias, SEP, Correlation and RSQ.

I´ve been doing this with other software`s, so it´s time for “R”. This is the script, please add feedback to improve it.

monitor2<-function(x,y){

n<-length(y)

res<-y-x

{rmsep<-sqrt(sum((y-x)^2)/n)

cat(“RMSEP:”,rmsep,”\n”)}

{(bias<-mean(res))

cat(“Bias :”,bias,”\n”)}

{sep<-sd(res)

cat(“SEP :”,sep,”\n”)}

{r<-cor(x,y)

cat(“Corr :”,r,”\n”)}

{rsq<-(r^2)

cat(“RSQ :”,rsq,”\n”)}

}

**Example:**

**> x<-c(1:10)**

**> y<-c(2:11)**

**> monitor2(x,y)**

**RMSEP: 1**

**Bias : 1**

**SEP : 0**

**Corr : 1**

**RSQ : 1**

To

**leave a comment**for the author, please follow the link and comment on his blog:**NIR-Quimiometría**.R-bloggers.com offers

**daily e-mail updates**about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...