similar to: How to use R to estimate a model which has two sets of lagged time series independent variables

Displaying 20 results from an estimated 3000 matches similar to: "How to use R to estimate a model which has two sets of lagged time series independent variables"

2018 May 31
2
How to alpha entire plot?
I have two chromatograms I want plotted on the same axes. I would like the plots to be transparent, so the first chart is not obscured. I have tried adjustcolor(..., alpha.f=0.3), the problem is that my chromatogram is so dense with datapoints that they overlap and the entire graph just ends up a solid color. The second histogram still obscures the first. Consider this example: col1 <-
2007 Feb 19
2
Calculating the Sharpe ratio
Hi useRs, I am trying to calculate the Sharpe ratio with "sharpe" of the library "tseries". The documentation requires the univariate time series to be a portfolio's cumulated returns. In this case, the example given data(EuStockMarkets) dax <- log(EuStockMarkets[,"FTSE"]) is however not the cumulated returns but rather the daily returns of the FTSE
2007 Apr 19
2
Filtering
Ein eingebundener Text mit undefiniertem Zeichensatz wurde abgetrennt. Name: nicht verf?gbar URL: https://stat.ethz.ch/pipermail/r-help/attachments/20070420/d7792b17/attachment.pl
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,
2008 Oct 22
1
R 2.8.0 qqnorm produces error with object of class zoo?
Dear list-reader, by running the following script: library(zoo) sessionInfo() search() packageDescription("zoo") data(EuStockMarkets) dax <- as.zoo(EuStockMarkets[1:10, "DAX"]) daxr <- diff(log(dax)) identical(as.vector(qnorm(daxr)), qnorm(coredata(daxr))) qqnorm(coredata(daxr)) qqnorm(daxr) qqnorm() produces an error: > qqnorm(daxr) Fehler in if (xi == xj) 0L
2005 Sep 29
2
priceIts
Dear All, There is an example for the priceIts function (the its package) which does not work for me as expected. > ?priceIts > x1 <- priceIts(instrument = c("^ftse"), start = "1998-01-01", + quote = "Close") Error in validObject(.Object) : invalid class "its" object: Missing values in dates > x2 <-
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:
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
2006 Nov 07
1
Comparison between GARCH and ARMA
Dear all R user, Please forgive me if my problem is too simple. Actually my problem is basically Statistical rather directly R related. Suppose I have return series ret with mean zero. And I want to fit a Garch(1,1) on this. my is r[t] = h[i]*z[t] h[t] = w + alpha*r[t-1]^2 + beta*h[t-1] I want to estimate the three parameters here; the R syntax is as follows: #
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 <-
2010 Mar 16
1
Simple for-loop runs out of memory
I have the following simple for-loop, which makes R crash every time. The length of the vectors is about 1200 rows, 1 column. n = max(length(GSPC),length(FTSE)) for(i in 1:1000) { if (row.names(GSPC)[i]==row.names(FTSE)[i]){ } else { if (row.names(GSPC)[i]>row.names(FTSE)[i]){ GSPC<-rbind(GSPC[1:(i-1),],GSPC[(i-1):length(GSPC),]) row.names(GSPC)[i]=row.names(FTSE)[i] } else {
2011 Mar 13
1
problem with looping formula through table
Dear useRs, I am stuck with a piece of code and hope you could give me some pointers. My aim is to calculate the lm-regression coefficients of individual stocks against an index. I am interested in both the coefficient and the pval. While I could do this manually for a select hand full, I hope to scale this up say for 30+ stocks (DAX-30, FTSE-100 etc.) to eventually have a matrix of coefficients
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 Jul 27
2
continuous independent variable in lme
Dear All, I am writing to ask a clarification on what R, and in particular lme, is doing. I have an experiment where fly wing area was measured in 4 selection lines, measured at 18 and 25 degrees. I am using a lme model because I have three replicated per line (coded 1:12 so I need not use getGroups to creat an orederd factor). The lines are called: "18"; "25";
2008 Mar 31
1
download.file error
Dear all, I am looking for a way to work out if a file on the internet exists before attempting to download it using the function download.file(). For example, using a url that does not exist url <- "http://finance.yahoo.com/ftse.csv" destfile <- tempfile() download.file(url = url, destfile = destfile) # gives the following response ... trying URL
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 =
2005 Dec 13
1
fSeries
I'm trying to use garchFit from fSeries, with Student or Skewed Student conditionnal distribution. Let's say that eps (vector) is my series of daily log-returns: data(EuStockMarkets) eps = diff(log(EuStockMarkets[,"CAC"])) library(fSeries) g = garchFit(series = eps, formula.var = ~garch(2,2), cond.dist = "dstd") s = g at fit$series All the coefficients are ok
2007 Apr 24
2
Log-Returns
Ein eingebundener Text mit undefiniertem Zeichensatz wurde abgetrennt. Name: nicht verf?gbar URL: https://stat.ethz.ch/pipermail/r-help/attachments/20070424/c6ce561b/attachment.pl
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
2010 Sep 04
1
tail.matrix returns matrix, while tail.mts return vector
Hi I have a few problems with tail/head when applied to multiple time series. I'm not sure as whether I did not understand the function or whether it correspond to an unexpected behavior. When head(a,n) is applied on data.frame or matrix, it returns a data-frame or matrix with first n obs of *each* variable. When applied to a mts object, it returns first n obs of *first* variable only,