Displaying 20 results from an estimated 700 matches similar to: "How to use "lag"?"
2008 Sep 10
2
arima and xreg
Dear R-help-archive..
I am trying to figure out how to make arima prediction when I have a
process involving multivariate time series input, and one 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
2004 Apr 16
2
regression and dw
Dear R People:
Suppose we have a regression model that we will call
y.lm
We run the Durbin Watson test for autocorrelation
and we find that there is positive autocorrelation,
and phi = 0.72, say.
What is our next step, please?
Do we calculate the following
yprime_t = y_t - 0.72y_t-1,
x1prime_t = x1_t - 0.72x1_t-1,
and so on, and re-fit the linear mode?
I haven't done this in a while.
2013 May 02
1
warnings in ARMA with other regressor variables
Hi all,
I want to fit the following model to my data:
Y_t= a+bY_(t-1)+cY_(t-2) + Z_t +Z_(t-1) + Z_(t-2) + X_t + M_t
i.e. it is an ARMA(2,2) with some additional regressors X and M.
[Z_t's are the white noise variables]
So, I run the following code:
for (i in 1:rep) { index=sample(4,15,replace=T)
final<-do.call(rbind,lapply(index,function(i)
2006 Mar 01
6
interrupted time series analysis using ARIMA models
Hi R-users,
I am using arima to fit a time series. Now I would like to include an intervention component "It (0 before intervention, 1 after)" using different types of impacts, that is, not only trying the simple abrupt permanent impact (yt = w It ) with the xreg option but also trying with a gradual permanent impact (yt= d * yt-1 + w * It ), following the filosophy of Box and Tiao
2005 Feb 18
9
Using time series and lm
Hello,
I apologize for this question that may has been asked a lot of times
but I could not go through it.
I create a multivariate time series containing NA values.
I want to compute a linear regression and obtain a time serie for both
residuals and fitted values. I have tried the trick ts.intersect,
without success.
Could you help me out of this?
####
Example:
y<-ts(1:10+rnorm(10))
2007 May 08
2
statistics/correlation question NOT R question
This is not an R question but if anyone can help me, it's much
appreciated.
Suppose I have a series ( stationary ) y_t and a series x_t ( stationary
)and x_t has variance sigma^2_x and epsilon is normal
(0, sigma^2_epsilon )
and the two series have the relation
y_t = Beta*x_t + epsilon
My question is if there are particular values that sigma^2_x and
sigma^2_epsilon have to take in
2004 Jan 14
3
How can I test if time series residuals' are uncorrelated ?
Ok I made Jarque-Bera test to the residuals (merv.reg$residual)
library(tseries)
jarque.bera.test(merv.reg$residual)
X-squared = 1772.369, df = 2, p-value = < 2.2e-16
And I reject the null hypotesis (H0: merv.reg$residual are normally
distributed)
So I know that:
1 - merv.reg$residual aren't independently distributed (Box-Ljung test)
2 - merv.reg$residual aren't indentically
2008 Dec 22
2
AR(2) coefficient interpretation
I am a beginner in using R and I need help in the interpretation of AR result
by R. I used 12 observations for my AR(2) model and it turned out the
intercept showed 5.23 while first and second AR coefficients showed 0.40 and
0.46. It is because my raw data are in million so it seems the intercept is
too small and it doesn't make sense. Did i make any mistake in my code? My
code is as follows:
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 in R:
arima(x, order=c(1,1,1), xreg=1:length(x))
is
2007 Jan 16
2
ARIMA xreg and factors
I am using arima to develop a time series regression model, I am using 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
2012 Mar 20
1
MA process in panels
Dear R users,
I have an unbalanced panel with an average of I=100 individuals and a total
of T=1370 time intervals, i.e. T>>I. So far, I have been using the plm
package.
I wish to estimate a FE model like:
res<-plm(x~c+v, data=pdata_frame, effect="twoways", model="within",
na.action=na.omit)
?where c varies over i and t, and v represents an exogenous impact on x
2012 Jul 28
4
quantreg Wald-Test
Dear all,
I know that my question is somewhat special but I tried several times to
solve the problems on my own but I am unfortunately not able to compute the
following test statistic using the quantreg package. Well, here we go, I
appreciate every little comment or help as I really do not know how to tell
R what I want it to do^^
My situation is as follows: I have a data set containing a
2007 May 21
1
Sample correlation coefficient question NOT R question
This is a statistics question not an R question. When calculating the
sample correlation coefficient cor(x_t,y_t) between say
two variables, x_t and y_t t=1,.....n ( one can assume that the
variables are in time but I don't think this really matters
for the question ), does someone know where I can find any piece of
literature that says that each (x_j,y_j) pair has
To be independent from the
2004 May 02
1
arima problems when using argument fixed=
As I am reading ?arima, only NA entries in 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)
2008 Sep 10
0
FW: RE: arima and xreg
hi: you should probably send below to R-Sig-Finance because there are
some econometrics people over there who could also possibly give you
a good answer and may not see this email ? Also, there's package called
mar ( I think that's the name ) that may do what you want ?
Finally, I don't know how to do it but I think there are ways of
converting a multivariate arima into the
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)
2004 Jan 14
2
Fixed parameters in an AR (or arima) model
Hello
I want to 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 =
2001 Feb 15
1
cointegrating regression
Hi all,
Can I run a cointegrating regression, for example
delta Xt=a1(Yt-1-cXt-1)+E1t
and
delta Yt=-b1(Yt-1-cXt-1)+E2t
with R were
Xt and Yt are non stationary time series at t
a,b,c are parameters and E1t and E2t are error terms at t.
Yt-Xt is stationary
Any suggestions are welcome.
Best regards,
/fb
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing
2011 Aug 04
2
Efficient way of creating a shifted (lagged) variable?
Hello!
I have a data set:
set.seed(123)
y<-data.frame(week=seq(as.Date("2010-01-03"), as.Date("2011-01-31"),by="week"))
y$var1<-c(1,2,3,round(rnorm(54),1))
y$var2<-c(10,20,30,round(rnorm(54),1))
# All I need is to create lagged variables for var1 and var2. I looked
around a bit and found several ways of doing it. They all seem quite
complicated - while in
2000 Apr 04
0
stochastic process transition probabilities estimation
Hi all,
I'm new with R (and S), and relatively new to statistics (I'm a
computer scientist), so I ask sorry in advance if my question is silly.
My problem is this: I have a (sample of a) discrete time stochastic
process {X_t} and I want to estimate
Pr{ X_t | X_{t-l_1}, X_{t-l_2}, ..., X_{t-l_k} }
where l_1, l_2, ..., l_k are some fixed time lags. It will be enough for
me to compute