Solved – Restricting a set of predictions to a range of values of non-negative numbers

I am not even sure how to even phrase this question so if anyone could help that would be great.

I am analyzing facebook activity and I wish to predict a particular activity (comments, for instance). Doing this with R, and using the package 'forecast' my prediction for the future periods with 80 and 95% yield lower boundaries of negative numbers – this can't be. The minimum possible comments that any activity could have is 0. What can I do to restrict this with a valid statistical background instead of running some code to limit these values?

EDIT:

Here is a MRE, with data that very closely resembles the parameters of the data I am working with (which unfortunately I can't share), but in reality, anything that has a sd larger than a mean would yield similar results:

 library(forecast)  TEST <- rnorm(150,mean=87,sd=140)  # change negatives to 0  TEST[TEST < 0] <- 0  #It's crucial that the sd is larger than the mean, if not, repeat first commands  mean(TEST)  sd(TEST)  arima.TEST <- arima(TEST, order = c(1,0,0))  forecast.Arima(arima.TEST, h =12)  #Lo 80 and Lo 95 are predicted in the negatives 

As I understand, you want to avoid the negative numbers from your random number generation. Instead of convert the negative values to 0, I only would change the negative to positive sign using the absolute function of R as follow:

 TEST <- abs(rnorm(150,mean=87,sd=140)) 

Similar Posts:

Rate this post

Leave a Comment