Hi, Does anyone know a method for adding a linear/polynominal trend to a simulated arima model using the arima.sim function? Any help will be greatly appreciated. Cheers, Sam.
What does "+" give you? It works for me -- simulate the model, simulate the trend and add them. x <- arima.sim(list(ar=0.3), 100) + 1:100 is an AR(1) with a linear trend.> arima(x, c(1,0,0), xreg=1:100)Call: arima(x = x, order = c(1, 0, 0), xreg = 1:100) Coefficients: ar1 intercept 1:100 0.4510 -0.1704 1.0031 s.e. 0.0915 0.3528 0.0060 ... On Thu, 4 Mar 2004, Samuel Kemp wrote:> Does anyone know a method for adding a linear/polynominal trend to a > simulated arima model using the arima.sim function?-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
As arima.sim() simulates stationary ARMA "errors" if your underlying model is additive I think you can type, for instance, just: x<-1:100 #time variable mu<-10+.5*x #linear trend y<-arima.sim(length(x), model=list(ar=.5, ma=-.3),sd=25)+mu arima(y, order=c(1,0,1),include.mean=TRUE,xreg=x) best, vito ----- Original Message ----- From: Samuel Kemp <sam.kemp2 at ntlworld.com> To: <r-help at stat.math.ethz.ch> Sent: Thursday, March 04, 2004 2:17 PM Subject: [R] adding trend to an arima model> Hi, > > Does anyone know a method for adding a linear/polynominal trend to a > simulated arima model using the arima.sim function? > > Any help will be greatly appreciated. > > Cheers, > > Sam. > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide!http://www.R-project.org/posting-guide.html