I am trying to answer the following question"
The time series given below gives the price of a dozen eggs in cents, adjusted for inflation. Fit a random walk to the time series egg.ts. What is the SS1PE?
library(tsdl)
eggs.ts <- tsdl[[440]]
I am stuck on how I fit a random walk to the time series. I know how to fit a general random walk using rnorm but not to a specific time series. There is a second part to this question below.
Modify your fit above to fit a random walk with a Holt-Winters slope term as well to the eggs time series. Compute the SS1PE. Is this a better fit than the random walk without the slope term? Use the model to predict egg prices for the next 28 years (the time series ends in 1993, so this will give us a prediction for 2021). What does the model predict will be the price of eggs in 2021? What does this tell us about the accuracy of the model?
I know this means to have a HoltWinters with alpha = 1, beta = gamma = False. However, I do not understand what is meant by the slope term.
Related
The original time series isn't stationary, it has trend and seasonality.
I prepared my dataset removing autocorrelation, trend and seasonality in order to have a stationary series and I made the predictions with Holt-Winters method.
How can I apply trend and seasonality to HW predictions?
Just to clarify my doubts: last demand data is around 3000 (with trend and seasonality), with HW I have a prediction around 0, how can I come back to real data to understand the "real" demand prediction?
I'm using R-Studio, do you have any specific function to suggest?
Thank you in advance
I am relatively new to both R and Stack overflow so please bear with me. I am currently using GLMs to model ecological count data under a negative binomial distribution in brms. Here is my general model structure, which I have chosen based on fit, convergence, low LOOIC when compared to other models, etc:
My goal is to characterize population trends of study organisms over the study period. I have created marginal effects plots by using the model to predict on a new dataset where all covariates are constant except year (shaded areas are 80% and 95% credible intervals for posterior predicted means):
I am now hoping to extract trend magnitudes that I can report and compare across species (i.e. say a certain species declined or increased by x% (+/- y%) per year). Because I use poly() in the model, my understanding is that R uses orthogonal polynomials, and the resulting polynomial coefficients are not easily interpretable. I have tried generating raw polynomials (setting raw=TRUE in poly()), which I thought would produce the same fit and have directly interpretable coefficients. However, the resulting models don't really run (after 5 hours neither chain gets through even a single iteration, whereas the same model with raw=FALSE only takes a few minutes to run). Very simplified versions of the model (e.g. count ~ poly(year, 2, raw=TRUE)) do run, but take several orders of magnitude longer than setting raw=FALSE, and the resulting model also predicts different counts than the model with orthogonal polynomials. My questions are (1) what is going on here? and (2) more broadly, how can I feasibly extract the linear term of the quartic polynomial describing response to year, or otherwise get at a value corresponding to population trend?
I feel like this should be relatively simple and I apologize if I'm overlooking something obvious. Please let me know if there is further code that I should share for more clarity–I didn't want to make the initial post crazy long, but happy to show specific predictions from different models or anything else. Thank you for any help.
I am working on GDP time series forcast. I have log transformed the time series which has significant stochastic trend. I have checked that the time series in first differences is stationary. Now (i believe) I have two options:
Fit an ARMA model on the differenced log transformed GDP time series
Fit an ARIMA model (p,1,q) on the log transformed GDP time series
QUESTION:
I have noticed that ARIMA does not have an intercept, while ARMA does. How is the intercept to be interpreted?
How should I decide which one to use?
I have noticed that ARIMA does not have an intercept, while ARMA does. How is the intercept to be interpreted?
The intercept interpretation depends on your model. It relates to your mean through your other parameter if the series is stationary. E.g., see the AR(1) example on wiki. An intercept in an order one differentiering ARIMA model implies a constant drift which is likely not what you want.
How should I decide which one to use?
A common choice is to use an information criteria like AIC or BIC. E.g., see this post.
In my mixed-effects model (lmer from lme4) I have a four-way interaction as a fixed effect including
a cubic polynomial of time (training sessions)
Age
Food dosis (half of the animals having 0 gr, whereas the rest varying from 1 until 7 gr)
Condition (4 levels).
My question concerns the issue that a polynomial as random slope has been discussed as over-complexifying the model and my model also does not converge when using poly in my random effects. When plotting the interaction and dichotomizing food and age for visualisation of my data,
I see that for the animals with food, the polynomial course is apparent across time for all conditions in a similar pattern, whereas no food intake was associated with a linear trend.
Two ideas about alternatives of using poly as a random slope:
alternative 1: just use time as a linear effect as a random slope, while keeping the polynomial time effect as a main effect
alternative 2: factorize time into lets say weeks (3 weeks in total),
because the polynomial effect for the animals with food followed a weekly pattern.
Comment on 2: of course this argumentation is somewhat arbitrary, therefore I was wondering if I could get some advice on a better solution.
Thank you so much for your assistance!
I have a day level dataset for 3 years,
I ran auto.arima() in R on it for simple time series forecasting and it gave me a (2,1,2) model.
When I used this model to predict the variable for the next 1 year the plot became constant after a few days, which can't be correct
As I have a daily data for 3 years, and a frequency of 364 days, is ARIMA incapable of handling daily data with large frequencies?
Any help will be appreciated
This sounds like you are trying to forecast too far into the future.
The forecast for tomorrow is going to be accurate, but the forecast for the next day and the day after that are not going to be influenced much by the past data and they will therefore settle around some constant when trying to forecast too far into the future. "Too far into the future" probably means two or more time points.
Lets say you have data up until time point T+100, which you used to estimate your ARIMA(2,1,2) model. You can "forecast" the value for time T+1 by pretending you only have data until point T and use your ARIMA(2,1,2) model to forecast T+1. Then move ahead by one period in your data and pretend you only have data until time T+1 and "forecast" T+2. This way you can assess the forecasting accuracy of your ARIMA(2,1,2) model, for example by calculating the Mean Squared Error (MSE) of the "forecasts".