Displaying 20 results from an estimated 6000 matches similar to: "regression using a lagged dependent variable as explanatory variable"
2006 Apr 14
4
how to count the columns of a data.frame
Hi,
I would like to count the columns of a data.frame. I know how to count the rows, but not the columns.
Can someone tell me how to do it?
My best regards,
Giacomo Moro
---------------------------------
[[alternative HTML version deleted]]
2007 Dec 13
2
How to use R to estimate a model which has two sets of lagged time series independent variables
Hi,
I would like to use R to estimate the following model:
X(t) = a + b1*X(t-1) + b2*X(t-2) + c1*Y(t) + c2*Y(t-1) + c3*Y(t-2)
Is there any R function that performs this type of estimation? I know
that if I only have one time series (i.e. lagged value of X) on the
right hand side then there are R functions to do the estimation. I am
thinking a work around by preparing X(t-1), X(t-2),Y(t),Y(t-1)
2012 Jul 25
3
lagged variables
hi guys,
i have some trouble in creating lagged variables to use as external
regressors.
i'm trying to use lag(x) but it gives me as result the same time series (x),
adding this part at the end:
attr(,"tsp")
[1] 0 2323 1
where do i wrong?are there other functions to be used?
thanks
sara
--
View this message in context:
2013 Apr 01
1
Parameter Estimation in R with Sums and Lagged Variables
Hi guys,
I am afraid I am stuck with an estimation problem.
I have two variables, X and Y. Y is explained by the weighted sum of n
lagged values of X. My aim is to estimate the two parameters
c(alpha0,alpha1) in:
Yt = Sum from j=1 to n of ( ( alpha0 + alpha1 * j ) * Xt-j )
Where Xt-j denotes the jth lag of X.
I came up with this approach because I thought it would be a good idea to
estimate
2002 Aug 06
2
help with lagged scatterplot
Hi,
How do I can make a lagged scatterplot of two variables:
Yt (nao) versus Xt-h (mei)
if they have the following structure:
>series
mei nao
Jan 1950 -1.036 0.55
Feb 1950 -1.133 3.31
Mar 1950 -1.259 0.81
Apr 1950 -1.027 1.60
May 1950 -1.399 -1.73
Jun 1950 -1.366 1.26
Jul 1950 -1.300 -0.87
.
.
.
I've tried with lag.plot but I don't understanf how to use it
Thanks in
2008 Oct 15
2
dynlm and lm: should they give same estimates?
Hi,
I was wondering why the results from lm and dynlm are not the same for what I think is the same model.
I have just modified example 4.2 from the Pfaff book, please see below for the code and results.
Can anyone tell my what I am doing wrongly?
Many thanks,
Werner
set.seed(123456)
e1 <- rnorm(100)
e2 <- rnorm(100)
y1 <- ts(cumsum(e1))
y2 <- ts(0.6*y1 + e2)
lr.reg <- lm(y2
2002 Feb 12
6
A couple of little R things I can't figure out (column percents, regression with lagged variables)
Simple usage questions that I ought to be able to figure on my own, but
can't.
1.I'm able to produce a cross tabulation table showing counts with
either table or xtabs. But I want column percentages for
interpretation, and it seems stupid to sit there with a calculator
figuring marginals and column percentages. How to make R do it after this:
> x <- c(1,3,1,3,1,3,1,3,4,4)
2011 Nov 30
2
forecasting linear regression from lagged variable
I'm currently working with some time series data with the xts package, and
would like to generate a forecast 12 periods into the future. There are
limited observations, so I am unable to use an ARIMA model for the forecast.
Here's the regression setup, after converting everything from zoo objects to
vectors.
hire.total.lag1 <- lag(hire.total, lag=-1, na.pad=TRUE)
lm.model <-
2017 Nov 21
1
R-How to unlist data frame multiple structured list column value and new column
Hi,
How to unlist list column value and add column into data frame.
Data frame
ID ContractDe PassengersDe TrainnerDe
1 list(ConID=c("Zx","78yu"),ConRes = c("98","Tut")) list(PassID
2005 Mar 05
4
How to use "lag"?
Is it possible to fit a lagged regression, "y[t]=b0+b1*x[t-1]+e",
using the function "lag"? If so, how? If not, of what use is the
function "lag"? I get the same answer from y~x as y~lag(x), whether
using lm or arima. I found it using y~c(NA, x[-length(x)])). Consider
the following:
> set.seed(1)
> x <- rep(c(rep(0, 4), 9), len=9)
> y <-
2008 Aug 18
2
Using lag
Dear all,
I am having difficulties using the seemingly-simple function lag.
I have a dataframe with several weather variables (maxitemp,
windspeed, rainfall etc), and the response variable (admissions). The
dataset is fairly large (1530 observations). I simply want to model the
response against a lag of a couple of the explanatory variables, say
maxitemp and rainfall. I would like to look at
2006 May 15
3
Dyn or Dynlm and out of sample forecasts
All:
How do I obtain one step ahead out-of-sample forecasts from a model
using "dyn" or "dynlm" ?
Thanks!
Best,
John
[[alternative HTML version deleted]]
2003 Nov 27
1
lagsarlm - using mixed explanatory variables (spdep package)
Hello
I'm very new to R (which is excellent), so apologies if this has already
been raised. In the spdep package, I'm trying to undertake an
autoregressive mixed model using the lagsarlm function. This is working
fine, but there does not appear to be a method of including an explanatory
variable without it automatically being included as a lagged term. I'm
after something along the
2007 Mar 22
2
dynamic linear models in R
Hi all,
I've just started working my way through Mike West and Jeff Harrison's
_Bayesian Forecasting and Dynamic Models_, and I was wondering if
there were any publically-available packages to handle dynamic linear
models, as they describe.
I found the "dynlm" package, but either I don't yet understand what's
going on or that package uses a different sense of the phrase
2011 Aug 01
1
ivreg and structural change
Hello,
I am looking for some help with this question: how could I test structural
breaks in a instrumental variables“s model?
For example, I was trying to do something with my model with three time
series.
tax_ivreg <- ivreg(l_y ~ l_x2 + l_x1+ dl_y | lag(l_x2, -1)+lag(l_x2, -2)+
lag(l_x1, -1)+lag(l_x1, -2)+lag(l_y, -1)+lag(l_y, -2), data=tax1)
summary(tax_ivreg)
## after estimating it,
2009 Apr 19
1
dynlm question: How to predefine formula for call to dynlm(formula) call
I want to set up a model with a formula and then run dynlm(formula)
because I ultimately want to loop over a set of formulas (see end of post)
R> form <- gas~price
R> dynlm(form)
Time series regression with "ts" data:
Start = 1959(1), End = 1990(4)
<snip>
Works OK without a Lag term
R> dynlm(gas ~ L(gas,1))
Time series regression with "ts" data:
Start =
2010 May 03
1
Plotting the explanatory against the dependent in a GAM
?
To whoever it may correspond,
My name is Oscar Saenz and I am working on my thesis in Spain.
I am using GAMs in "R" and, now that I have estimated my models, I need to plot the predicted smooth functions against the dependent variable (just as in Carlslaw et al. 2007, fig. 1*).
Otherwise, I'd like to know how to plot the smoothed predictor variable values against the partial
2013 May 09
2
[LLVMdev] LoopPass symbol error
Thanks,
Also, every method inherited by LoopBase causes the same error, while Loop
methods go smooth.
On 9 May 2013 01:05, Andrew Trick <atrick at apple.com> wrote:
>
> On May 8, 2013, at 7:43 PM, Giacomo Tagliabue <giacomo.tag at gmail.com>
> wrote:
>
> Hello,
> I am building a loop pass following these instructions:
>
2013 Feb 26
1
problem with nested loops
Each of the data sets contains monthly observations on price indices for 7 countries. I use the fitted values from reg1 in the reg2 model. The interior loop executes without error as long as I explicitly specify the data set, i.e. data=dat70. However the code fails to execute if I specify the model in the form of the commented line, i. e reg1 <-dynlm(form1,data=Dnames[j])
I get the following
2013 May 09
0
[LLVMdev] LoopPass symbol error
Wow, commenting those two lines worked out fine for me, thanks!
On 9 May 2013 09:34, Giacomo Tagliabue <giacomo.tag at gmail.com> wrote:
> Thanks,
> Also, every method inherited by LoopBase causes the same error, while Loop
> methods go smooth.
>
>
> On 9 May 2013 01:05, Andrew Trick <atrick at apple.com> wrote:
>
>>
>> On May 8, 2013, at 7:43 PM,