search for: xreg

Displaying 20 results from an estimated 134 matches for "xreg".

Did you mean: reg
2013 Mar 22
0
predict.Arima error "'xreg' and 'newxreg' have different numbers of columns"
Hello all, I use arima to fit the model with fit <- arima(y, order = c(1,0,1), xreg = list.indep, include.mean = TRUE) and would like to use predict() to forecast: chn.forecast <- rep(0,times=num.record) chn.forecast[1] <- y[1] for (j in 2:num.record){ indep <- c(aa=chn.forecast[j-1], list.indep[j,2:num.indep]) # this is the newx...
2008 Jan 11
1
question about xreg of arima
Hi, I am trying to understand exactly what xreg does in arima. The documentation for xreg says:"xreg Optionally, a vector or matrix of external regressors, which must have the same number of rows as x." What does this mean with regard to the action of xreg in arima? Apparently somehow xreg made the following two arima fit equivalent i...
2010 Mar 31
1
predict.Arima: warnings from xreg magic
When I run predict.Arima in my code, I get warnings like: Warning message: In cbind(intercept = rep(1, n), xreg) : number of rows of result is not a multiple of vector length (arg 1) I think this is because I'm not running predict.Arima in the same environment that I did the fit, so the data object used in the fit is no longer present. Looking at the predict.Arima source, predict.Arima <-...
2008 Sep 10
2
arima and xreg
...output time series (output is to be predicted) .. (thus strictly speaking its an ARMAX process). I know that the arima function of R was not designed to handle multivariate analysis (there is dse but it doesnt handle arma multivariate analysis, only simulations). But there is this beautiful "xreg" as parameter for arima and I was wondering.. for the case of one output series I can actually "trick" R in doing multivariate time series for me no?.. because I saw in the documentation, xreg can be inputed as a ---matrix--- with output.len (length of output data) number of rows.. S...
2007 Jan 16
2
ARIMA xreg and factors
...arima b/c I have autocorrelated errors. Several of my independent variables are categorical and I have coded them as factors . When I run ARIMA I don't get any warning or error message, but I do not seem to get estimates for all the levels of the factor. Can/how does ARIMA handle factors in xreg? here is some example code: sim.ar <- arima.sim(list(ar = c(0.4, 0.4)), n = 1000) z<- factor(rep((1:5),200)) arima(sim.ar,order=c(2,0,0),xreg=z) I only get a single estiamte for xreg. Am I thinking about this wrong (I expected 4). thank you, Spencer [[alternative HTML version dele...
2009 Mar 06
0
modifying a built in function from the stats package (fixing arima) (CONCLUSIONS)
...ad in "exitpoint 0" changes the coefficients for which arima can't fit a model but results in terms of aic and sigma2 also change significantly. By visual inspection I think that BFGS works better. function (x, order = c(0, 0, 0), seasonal = list(order = c(0, 0, 0), period = NA), xreg = NULL, include.mean = TRUE, transform.pars = TRUE, fixed = NULL, init = NULL, method = c("CSS-ML", "ML", "CSS"), n.cond, optim.control = list(), kappa = 1e+06) { "%+%" <- function(a, b) .Call(R_TSconv, a, b) upARIMA <- function(mod, phi...
2005 Mar 05
4
How to use "lag"?
...llowing: > set.seed(1) > x <- rep(c(rep(0, 4), 9), len=9) > y <- (rep(c(rep(0, 5), 9), len=9)+rnorm(9)) # y[t] = x[t-1]+e > > lm(y~x) (Intercept) x 1.2872 -0.1064 > lm(y~lag(x)) (Intercept) lag(x) 1.2872 -0.1064 > arima(y, xreg=x) intercept x 1.2872 -0.1064 s.e. 0.9009 0.3003 sigma^2 estimated as 6.492: log likelihood = -21.19, aic = 48.38 > arima(y, xreg=lag(x)) intercept lag(x) 1.2872 -0.1064 s.e. 0.9009 0.3003 > arima(y, xreg=c(NA, x[-9])) intercept...
2008 Sep 10
0
FW: RE: arima and xreg
...(output is to be predicted) .. (thus strictly speaking its an > ARMAX process). I know that the arima function of R was not designed > to handle multivariate analysis (there is dse but it doesnt handle > arma multivariate analysis, only simulations). But there is this > beautiful "xreg" as parameter for arima and I was wondering.. > for the case of one output series I can actually "trick" R in doing > multivariate time series for me no?.. because I saw in the > documentation, xreg can be inputed as a ---matrix--- with output.len > (length of output data...
2009 Mar 26
1
arima, xreg, and the armax model
Hello all, I''m having fun again with the arima function. This time I read in: http://www.stat.pitt.edu/stoffer/tsa2/R_time_series_quick_fix.htm <<It has recently been suggested (by a reliable source) that using xreg in arima() does NOT fit an ARMAX model [insert slap head icon here]. This will be investigated as soon as time permits.>> (by R.H. Shumway & D.S. Stoffer) This is quite surprising... Does anybody know anything about it? Marc Vinyes (AleaSoft) [[alternative HTML version deleted]]
2004 May 02
1
arima problems when using argument fixed=
...the argument fixed= imports. The following seems to indicate otherwise: x <- arima.sim(model=list(ar=0.8), n=100) + (1:100)/50 > t <- 1:100 > mod1 <- lm(x ~ t) > > init1 <- c(0, coef(mod1)[2]) > fixed1 <- c(as.numeric(NA), 0) > > arima(x, order=c(1,0,0), xreg=t, include.mean=FALSE, init=init1, fixed=fixed1) Call: arima(x = x, order = c(1, 0, 0), xreg = t, include.mean = FALSE, fixed = fixed1, init = init1) Coefficients: ar1 t 0.9281 0 s.e. 0.0357 0 sigma^2 estimated as 0.9186: log likelihood = -138.64, aic = 281.28 > &...
2012 Oct 04
1
[LLVMdev] RegisterClass constraints in TableGen
...e. This architecture has two single-ported register files. Each instruction can only read one operand from each register file, but can write to either. I tried implementing it naïvely in TableGen with two definitions per instruction, so I had: def AllRegs : RegisterClass< ... (add interleave (XRegs, YRegs))>; and in the InstrInfo.td: def Instr_xy: Instruction(outs AllRegs:$dst), (ins XRegs:$src1, YRegs:$src2), "...", [(set AllRegs:$dst, (OpNode XRegs:$src1, YRegs:$src2))] def Instr_yx: Instruction(outs AllRegs:$dst), (ins YRegs:$src1, XRegs:$src2), "...", [(set AllR...
2009 Nov 09
0
ARIMA, xreg and intercepts
David Stoffer describes some challenges with R's output when fitting ARIMA models for different orders (see Issue 2 at http://www.stat.pitt.edu/stoffer/tsa2/Rissues.htm). R doesn't fit an intercept in the model if there is any differencing. David describes a workaround using the xreg parameter to force R to calculate an intercept. Assume I have a variable y and 3 explanatory variables a, b and c. No intercept would be produced for the model .... fit = arima(y, order=c(1,1,0), xreg=c(a,b,c)) 1. If I wish to force an intercept to be output is the following correct? intercep...
2008 Jul 08
0
forecast & xreg
Dear all, I am fitting an arimax (arima with some extra explanatory variables) model to a time series. Say, I have a Y (dependent variable) and an X (explanatory). Y is 100 observations (time series) and X is 100 + 20 (20 to use for the forecast horizon). I can not make xreg work with the forecast function for an arima fit. The "predict" function seems to be working but the "forecast" returns > Error in predict.Arima(object, n.ahead = h) : 'xreg' and 'newxreg' have different numbers of columns... Xreg is a time series...
2008 Nov 27
1
"xreg" in ARIMA modelling.
Hello, Does anyone know how the parameter estimates are calculated for xreg variables when called as part of an arima() command, or know of any literature that provides this info? In particular, I was wondering if there is a quick way to compare different combinations of "xreg" variables in the arima() fit in the same way that you would in multiple regression (u...
2012 Mar 20
1
MA process in panels
...-1 for ( i in unique(pdata_frame$i)){ dem_yt[na.omit(pdata_frame$i)==i][1:n]<-rep(NA,n) demXt$c[na.omit(pdata_frame$i)==i][1:n]<-rep(NA,n) demXt$v[na.omit(pdata_frame$i)==i][1:n]<-rep(NA,n) } #I think I should now be able to use standard ARIMA methods such as res2<-arima(x=dem_yt,xreg=demXt,order=c(0,0,1)) #Alternatively, I tried to obtain res2 using maxLik() from the maxLik package, but I am not sure about how to specify the log-likelihood function: tslag <- function(x, d=l) { x <- as.vector(x) n <- length(x) c(rep(NA,d),x)[1:n] } log_Lik<-function(param)...
2007 Nov 02
0
Significance-Problems by using arma/xreg.
Hello. I've got a problem with arma/xreg. I would like to get a better model-fit by implenting some external explanatory variable, so I thought I can implement it by expand the arima-function with an xreg-argument: I have two stationary data vectors y and x of length 201: y <- c(0.935179888,1.099621832,1.020898987,1.031344228,1.02739...
2012 Nov 14
0
Time Series with External Regressors in R Problems with XReg
...ghtforwardly in R. However, I wanted to add a couple of regressors to the arima model to see if it could improve the accuracy of the forecasts but have had a hard time trying to do so. I used the following R function: arima(x, order = c(0, 0, 0), seasonal = list(order = c(0, 0, 0), period = NA), xreg = NULL, include.mean = TRUE, transform.pars = TRUE, fixed = NULL, init = NULL, method = c("CSS-ML", "ML", "CSS"), n.cond, optim.method = "BFGS", optim.control = list(), kappa = 1e6) Now, I know that you don?t need all the parameters in the function so I basi...
2010 Jul 06
0
Differencing with auto.arima and xreg
I am having some issues with differencing using auto.arima when also specifying an xreg dataframe. The xreg dataframe contains dummy variables that specify time periods that had a promotion running. When I model diff(y) with order (1,0,1), the coefficients for these dummy variables are very different than when I model y with order=(1,1,1). I think when modeling diff(y) the coeffici...
2004 Jan 14
2
Fixed parameters in an AR (or arima) model
...fit an AR model were two of the coefficients are fixed to zero (the second and third ar-coefficients). I used the "arima" function with the "fixed" argument but the ar3 coefficient is not set to zero: ============================================== > arima(Y, order=c(4,0,0), xreg=1:23, fixed=c(NA,0,0,NA,NA,NA)) Call: arima(x = Y, order = c(4, 0, 0), xreg = 1:23, fixed = c(NA, 0, 0, NA, NA, NA)) Coefficients: ar1 ar2 ar3 ar4 intercept 1:23 0.5370 0 0.4338 -0.8078 5.2991 -0.0421 s.e. 0.0735 0 0.0000 0.1096 0.1081 0.0079...
2009 Feb 17
0
What's the predict procedure of ARIMA in R?
...setting of errors,etc.)? I run the following commands and get the original code of the "predict" command, but I can't read it. Can anybody explain it to me? Thanks! saji from Shanghai the code: > getS3method("predict","Arima") function (object, n.ahead = 1, newxreg = NULL, se.fit = TRUE, ...) { myNCOL <- function(x) if (is.null(x)) 0 else NCOL(x) rsd <- object$residuals xr <- object$call$xreg xreg <- if (!is.null(xr)) eval.parent(xr) else NULL ncxreg <- myNCOL(xreg) if (myNCOL(newxreg) !=...