Displaying 20 results from an estimated 10000 matches similar to: "Regression and time series"
2005 Apr 12
1
Time series misalignment
This maybe a basic question, but I have spent several hours
researching and I could not get an answer, so please bear with me. The
problem is with time series in the package tseries. As the example
below shows, the time series can get misaligned, so that bad results
are obtained when doing regressions. I found a way to do this
correctly, but I find it rather cumbersome. My question is: is there a
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
2005 Sep 21
3
ts.intersect bug?
This code gives an error:
a <- ts(1:10, start=0, freq=10)
b <- ts(1:10, start=1, freq=10)
ts.intersect(a,b)
This one works normally (and correctly):
a <- ts(1:10, start=0)
b <- ts(1:10, start=1)
ts.intersect(a,b)
Antonio, Fabio Di Narzo.
P.S. How to switch off italian error messages to post on r-help?
> version
_
platform i386-pc-mingw32
arch i386
os
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))
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 27
3
Time series indexes
I tried to assign values to specific elements of a time series and got
in trouble. The code below should be almost self-explanatory. I wanted
to assign 0 to the first element of x, but instead I assigned zero to
the second element of x, which is not what I wanted. Is there a
function that will allow me to do this without going into index
arithmetic (which would be prone to errors)?
FS
>
2011 May 04
1
fGarch
Hi,
I am attempting to fit a ARMA/GARCH regression model without success.
### ARIMA-GARCH model with regressor ###
### Time series data: A multivariate data set.
cov.ts.dq = cov.ts[1:4,"dq1"][!is.na(cov.ts[,"dq1"])]
cov.ts.day = ts.intersect(dq = diff(q.ts), day = lag(q.ts, -1))
### The following R scripts work:
(summary(no.day.fitr <- garchFit(dq ~ arma(0,3) +
2008 Apr 30
2
Can R do rts (Regular Time Series) like S-Plus?
Dear readers,
S-Plus have a rts function (Regular Time Series), which is used like so:
fveks<-read.csv('http://louise.hoffman.googlepages.com/veks.csv',header=TRUE,sep=',')
attach(fveks)
acf(ts.intersect(rts(HC.f),rts(Ta.f),rts(GR.f),rts(W.f)))
Warning the csv file is 750kB.
Can the same be done in R?
Lots of love =)
Louise
2011 Dec 13
2
Problem with ploting fitted values
Hello!
I have such a problem...
Estimated a model based on common data (you can find it in R library), and I
wanted to plot the orginal values with the estimated one. Unfortunately I
can only see the original values.
Below is the code with data library:
/
library(forecast)
data(AirPassengers)
AP <- AirPassengers
class(AP)
start(AP)
end(AP)
frequency(AP)
lgAP <- log(AP)
t<-2:length(AP)
2005 Jun 16
1
lm and time series: simple question
Hello:
This question is partly about R and partly out of my ignorance about time series.
I want to regress one time series on another, taking into account the
autocorrelation (in an AR1 model) within each series. I am interested in how
the standard error changes when the acf is taken into account.
I've made both of my datasets into ts objects and used the basic lm function
(with
2005 Apr 26
2
Extending time series
I noticed that when one tries to extend a time series (ts) object by a
single period using window() actually two observations (NAs) are
added. See below for an example. Does anyone know the reason for this
behavior and how to avoid it?
Thanks.
FS
> x<-ts(c(1,2,3))
> x1<- window(x, start(x), end(x) + 1, extend = TRUE)
> x1
Time Series:
Start = 1
End = 5
Frequency = 1
[1] 1 2
2005 Jun 03
1
ts.intersect a multivariate and univariate ts
This seems like a FAQ, but I can't figure it out.
I have a mv ts object:
R > tsp(pg)
[1] 1982 2003 1
R > dim(pg)
[1] 22 12
and a univariate ts:
R > tsp(rw)
[1] 1690 1996 1
Yet, when I try to intersect them:
R > tsp(ts.intersect(rw, pg))
[1] 1982 2176 1
the process goes awry.
How to I get rw and pg to be one ts that runs from 1982 to 1996 and has 13
univariate time
2007 Dec 05
1
Working with "ts" objects
I am relatively new to R and object oriented programming. I have relied on
SAS for most of my data analysis. I teach an introductory undergraduate
forecasting course using the Diebold text and I am considering using R in
addition to SAS and Eviews in the course. I work primarily with univariate
or multivariate time series data. I am having a great deal of difficulty
understanding and working with
2000 Sep 20
1
lag() and lm()
Hi,
I am using R interactively for estimation and even data manipulation. I want
to use lag() function within lm() function in a way looks like:
mymodel<- lm(y~x+I(lag(y,-1)-1, data=anydata)
What I get is always perfect fit; (that is, coefficient=1) which is not
true.
If the model looks like
mymodel<- lm(y~z+x+I(lag(x,-1)-1, data=anydata)
summary returns only one coefficient for x and
2011 Jan 03
3
optimize
Hi all,
I'm trying to get the value of y when x=203 by using the intersect of
three curves. The horizontal curve does not meet with the
other two. How can I rectify the code below?
Thanks
Muhammad
ts <- 1:10
dd <- 10:1
ts <- seq(200,209,1)
dd <- c(NA,NA,NA,NA,1.87,1.83,1.86,NA,1.95,1.96)
plot(ts,dd,ylim=c(1.5,2))
abline(lm(dd~ts),col="blue",lty=2)
2016 Feb 09
2
problem plotting "ts" in a data.frame
Hello:
I'm having trouble plotting an object of class "ts" that is in a
data.frame. I can do it with(data.frame, plot(...)) but not with
plot(..., data.frame); see the example below.
This work around gets me past this problem. However, I thought
the R Core team might want to know about this if they don't already.
Thanks for all your work in making
2008 Sep 04
1
Building a time series.
I have a need to build a time series and there are a couple of aspects about the time series object that are confusing me. First it seems that ts.union is not doing what I would expect. For example:
x0 <- rep(0,10)
x1 <- rep(1,10)
xt0 <- ts(x0, frequency=10)
xt1 <- ts(x1, frequency=10)
st2 <- ts.union(xt0, xt1)
> xt2
Time Series:
Start = c(1, 1)
End = c(1, 10)
Frequency = 10
2017 Sep 01
0
Precision error in time index of ts objects
On Fri, 1 Sep 2017, Andrea Altomani wrote:
> I should have formulated my question in a more specific way.
>
> 1. I suspect this is a floating point precision issue. I am not very
> knowledgeable about R internals, can someone else confirm it?
Yes. If you represent a series with increment 1/12 it depends on how you
do it. As a simple example consider the following two descriptions
2004 Apr 25
1
ts's in lm()
Is this a bug?
seasonal.dummies <-
function(x, contr=NULL) {
# takes a time series and returns a matrix of seasonal dummies for
# x. This is almost cycle(x), we only have to make it into a factor
# and add suitable level names.
# return a matrix which includes a constant!
# level names here assumes frequency is 12!
cyc <- factor( cycle(x), labels=c("ene","feb",
2003 Jun 06
3
irregular time-series
I make quite a lot of use of irregular time-series, and had already spent a
bit of time writing an 'its' class when the 'irts' class was released via
the package 'tseries'.
I have experimented with the 'irts' class, and have some practical issues
with its use. In some applications of irregular time-series (in my case
these are financial and econometric) there are