similar to: newbie questions...

Displaying 20 results from an estimated 60000 matches similar to: "newbie questions..."

2006 Mar 02
1
CCF and Lag questions
I am new to R and new to time series modeling. I have a set of variables (var1, var2, var3, var4, var5) for which I have historical yearly data. I am trying to use this data to produce a prediction of var1, 3 years into the future. I have a few basic questions: 1) I am able to read in my data, and convert it to a time series format using 'ts.' data_ts <- ts(data, start = 1988, end =
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 <-
2010 Jul 21
1
The opposite of "lag"
Hello! I have a data frame A (below) with a grouping factor (group). I take my DV and create the new, lagged DV by applying the function lag.it (below). It works fine. A <- data.frame(year=rep(c(1980:1984),3), group= factor(sort(rep(1:3,5))), DV=c(rnorm(15))) lag.it <- function(x) { DV <- ts(x$DV, start = x$year[1]) idx <- seq(length = length(DV)) DVs <- cbind(DV, lag(DV,
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
2004 Oct 29
2
lag variable addition to data frame question
Hi, I was wondering if there is a more efficient way of handling the following method of creating a lagged value in a data frame without using the recursive 'for(i in 1:n)' loop and without using as.ts #Steps to creating a lag variable in a data frame 'my.dat.fr' # with 275 columns, 2400 rows of numbers and factors . The #variable x is a factor of #with five different levels the
2010 Feb 07
1
Out-of-sample prediction with VAR
Good day, I'm using a VAR model to forecast sales with some extra variables (google trends data). I have divided my dataset into a trainingset (weekly sales + vars in 2006 and 2007) and a holdout set (2008). It is unclear to me how I should predict the out-of-sample data, because using the predict() function in the vars package seems to estimate my google trends vars as well. However, I want
2002 Feb 13
1
cor() and lagged ts objects
The following is internally consistent, but not intuitive: R : Copyright 2002, The R Development Core Team Version 1.4.1 (2002-01-30) [...] > library(ts) > x<-rnorm(100) # white noise > xTS<-ts(x,start=1) # as time series > xTSl<-lag(xTS,lag=-1) # lagged once > cor(xTS,xTSl) # Big surprise [1] 1 > cor(cbind(xTS,xTSl),use="pairwise") # what was really
2005 Oct 15
2
regression using a lagged dependent variable as explanatory variable
Hi, I would like to regress y (dependent variable) on x (independent variable) and y(-1). I have create the y(-1) variable in this way: ly<-lag(y, -1) Now if I do the following regression lm (y ~ x + ly) the results I obtain are not correct. Can someone tell me the code to use in R in order to perform a regression using as explanatory variable a lagged dependent variable? My best regards,
2005 Aug 13
1
How to make a lagged variable in panel data?
Suppose we observe N individuals, for each of which we have a time-series. How do we correctly create a lagged value of the time-series variable? As an example, suppose I create: A <- data.frame(year=rep(c(1980:1984),3), person= factor(sort(rep(1:3,5))), wage=c(rnorm(15))) > A year person wage 1 1980 1 0.17923212 2 1981
2008 May 22
1
How to account for autoregressive terms?
Hi, how to estimate a the following model in R: y(t)=beta0+beta1*x1(t)+beta2*x2(t)+...+beta5*x5(t)+beta6*y(t-1)+beta7*y(t-2)+beta8*y(t-3) 1) using "lm" : dates &lt;- as.Date(data.df[,1]) selection&lt;-which(dates&gt;=as.Date("1986-1-1") &amp; dates&lt;=as.Date("2007-12-31")) dep &lt;- ts(data.df[selection,c("dep")]) indep.ret1
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:
2003 Jun 10
1
Regression output labels
Hello to all- 1. When I run a regression which implements the augmented Dickey-Fuller test, I am confused about the names given to the regressors in the output. I understand what "xGE" stands for in a standard "lm" test involving an independent variable GE for instance, but if I lags and or differences are included in the model, what do the following "output" stand
2005 Apr 26
1
Time alignment of time series
One thing that has given me trouble is the fact that the time series implementation in the class ts relies on the concept of a "start" to the time series. For example, if I have ts1 <- ts(c(1,2,3)) dts1 <- diff(ts1) then dts1 will be a vector c(1,1) but with the attribute start = 2. Similarly, when one takes lags the "start" is moved around and the underlying vector
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)
2004 Mar 03
1
partial autocorrelation for Rt vs. Nt-1, ......., Nt-h
Dear list, following a previous querry we are still stuck! As pointed out by Erin Hodges the "ts" library includes a PACF function which reports the partial correlation of population density at time t against lagged population density. However, what we are trying to calculate is the partial correlation between rate of population change, Rt=log Nt/Nt-1, against lagged population
2012 Jan 10
1
Lag() and lag()
lag is a very confusing function i try to plot lag(x,-h) and y , the results are the same figures for all the h lags. then i saw online people use lag(x,-h) as xreg in arima that won't work in my eyes if lag function is consistent, isnce it returns the same value for all the lags i don't know in which occasion people will use this function besides I suppose Lag(x,h) is the same as
2007 Mar 18
2
Lag operator in R does not work
Hi - I'm quite wondering what makes the lag operator does not work for my time series. I have a time series of length about 200000 elements. I would like to have a lag 1 of this time series. I did the following: logprice = log(price, base=exp(1)) # this is my log price which is a vector of price time series of length 200000 ts_logprice = as.ts(logprice, frequency=1) # convert to time series
2003 May 29
2
Newbie trying to Lag Variables in a regression
Perhaps I am making this too hard, but how does one regress y(t) on a constant, x(t-1) and y(t-1)? I've tried the manuals and until I get Dalgaard's book (just ordered on Amazon), I am stuck! Thanks to all in advance for your patience and consideration.
2003 Mar 25
1
NEWBIE : Configure Samba
Hi all, 1st, sorry for ask those questions one more time on the list. I desesperately type to install Linux and (of course) Samba on my home network. I have 1 server, running W2K pro who should migrate to Linux asap. The 2 workstations are running W2K pro and would stay with this f... OS. My questions : 1. The nicest way to use accounts seems to use the Linux accounts and to synchronize them
2018 Jun 15
2
Strange Machineinstr
Hi I write a machinefunction pass to print all the machinefunction's machine instructions. My target architecture is ARM. However, I don't understand some part of the machine instructions. Below is some of the assembly language for function A. .text:0001C034 STMFD SP!, {R4,R10,R11,LR} > .text:0001C038 ADD R11, SP, #8 > .text:0001C03C