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 inï¬‚ation of sMAPE caused by zero values in the series.

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)

## Related Discussions

Discussion Overview
 group r-help categories r posted Jun 1, '12 at 10:46a active Jun 1, '12 at 10:46a posts 1 users 1 website r-project.org irc #r

### 1 user in discussion

Content

People

Support

Translate

site design / logo © 2017 Grokbase