Grokbase Groups R r-help June 2012
FAQ
Dear Researchers,

I am looking for a library or a function to calculate SMAPE with same
doneminator to avoid a problem to the presence of 0 values in the series.
I find this variotion of SMAPE called mSMAPE

mSMAPE page 13

http://www.stat.iastate.edu/preprint/articles/2004-10.pdf


yesterday nigth i tried to create a function but without a good result. For
this reason I wish to know if some reserchers develop a solution to avoid
the possibility of an inflation of sMAPE caused by zero values in the series.


Thanks in advance
Gianni


# this is my mSMAPE function but there is some problem

SMAPEper <- function(x,y){mean((200*(abs(x-y)))/(x+y))}
obs <- c(10,20,30,40)
pred <-c(5,6,7,8)


mSMAPE <- function(obs,pred){
M <- numeric(length(obs))

for (i in 2:length(obs)) {
n <- i-1
M[i] <- mean(obs[1:n])
}
sum1 <- (abs(obs[1]-pred[1]))/(0.5*(abs(pred[1])+abs(obs[1])))

for (i in 2:length(obs)) {
n <- i-1
sum2 <- 0
for (k in 1:n) {sum2 <- sum2+abs(obs[k]-M[k])}
S <- sum2/n
sum1 <-
sum1+(abs(obs[i]-pred[i]))/(0.5*(abs(pred[i])+abs(obs[i]))+S)
}

my.SMAPE <- sum1/length(obs)
return(my.SMAPE)
}

mSMAPE(obs,pred)*100
SMAPEper(obs,pred)

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupr-help @
categoriesr
postedJun 1, '12 at 10:46a
activeJun 1, '12 at 10:46a
posts1
users1
websiter-project.org
irc#r

1 user in discussion

Gianni lavaredo: 1 post

People

Translate

site design / logo © 2017 Grokbase