r - Time series with multiple periods and non negative values -
when read time series in ts object
, put period:
tr <- ts(data[,4],frequency=)
. works 2 different periods , decomposes show (downward) trend, seasonality , error. how know correct period.when use
ets
orstlf
function inforecast
package on above ts object, summary shows: model information:ets(a,n,n)
why that? have seasonal+trend component here?what can deal negative values when training set non-negative , negative values make no sense.
what correct period depends on data generating process. instance, if looking @ monthly data driven consumer habits, then, if presume consumer behavior fluctuates based on changing circumstances throughout year, since data monthly, 12 frequency select. important keep in mind periodicity multiplicative. if, instance, 12 , 24 work, i'd go 12. if have quarterly data, maybe 4 frequency select. alternatively, if looking @ physical process, temperature in engine, , have millisecond data, maybe appropriate period number of milliseconds per revolution.
the last 2 n's mean "none." unable tell why think there seasonal component , ets not. file:
usually three-character string identifying method using framework terminology of hyndman et al. (2002) , hyndman et al. (2008). first letter denotes error type ("a", "m" or "z"); second letter denotes trend type ("n","a","m" or "z"); , third letter denotes season type ("n","a","m" or "z"). in cases, "n"=none, "a"=additive, "m"=multiplicative , "z"=automatically selected. so, example, "ann" simple exponential smoothing additive errors, "mam" multiplicative holt-winters' method multiplicative errors, , on.
it possible model of class "ets", , equal output previous call ets. in case, same model fitted y without re-estimating smoothing parameters. see use.initial.values argument.
what negatives depends on data generating process. if, once forecasted variable reaches zero, process stops (i.e. have absorbing state), maybe can set foretasted values zero. if, however, believe downward movements become smaller , smaller, may have change model reflect this. setting
lambda=0
start, equivalent taking logarithms. make model multiplicative. but, in general, if forecasts becoming negative , know impossible, model of data generating process wrong.
Comments
Post a Comment