Re: [R] CCF and missing values.

2011-01-20 Thread David Stoffer
combine them and then use acf: x - ts(rnorm(10)) y - ts(x+ rnorm(10)) u - ts.union(x, y) (acf(u, na.action=na.pass)) I don't know if it's correct, but it gives an answer... I'm too afraid to check if it's correct. -- View this message in context:

Re: [R] Is it possible to make a matrix to start at row 0?

2010-11-22 Thread David Stoffer
bogdanno-2 wrote: I want to make the matrix to be indexed from row (column) 0, not 1 Can I do that? How? Thanks __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] Kalman filter

2010-11-22 Thread David Stoffer
It sounds like you've looked at the DLM, DSE, and SSPIR packages. If not, then certainly check them out. Also, we have code for filtering, smoothing and estimation in our text- go to www.stat.pitt.edu/stoffer/tsa3/ and look at the code for chapter 6. There's not a package for the text, but all

Re: [R] Multiple time series and their names

2009-10-03 Thread David Stoffer
) -0.84970010 3(1) -0.05944844 3(2) 1.27543030 tsp(x) [1] 1.00 3.25 4.00 tsp(as.ts(as.zoo(x))) [1] 1.00 3.25 4.00 On Fri, Oct 2, 2009 at 11:15 PM, David Stoffer dsstof...@gmail.com wrote: Suppose I have multiple time series with names for each one, for example, x - ts(matrix(rnorm

Re: [R] Multiple time series and their names

2009-10-03 Thread David Stoffer
That info along with drop=FALSE seems to be a reasonable hack. Thanks again- David Gabor Grothendieck wrote: You can use names using your example ts series like this x[, Juan] On Sat, Oct 3, 2009 at 11:04 AM, David Stoffer dsstof...@gmail.com wrote: Thanks for the help.  My

[R] Multiple time series and their names

2009-10-02 Thread David Stoffer
Suppose I have multiple time series with names for each one, for example, x - ts(matrix(rnorm(30,0,1),10,3), names=c(Juan, Tuey, Trey), frequency=4) So now, as I start to explore these series, if I do everything at once, the names stay attached to the series. For example, plot(x) # gives a

Re: [R] arima, xreg, and the armax model

2009-05-03 Thread David Stoffer
Hi Marc- I have been [and am] extremely busy and haven't had much time to be a playeR (lately I've become more of a moveR and shakeR ... some say more of a boozeR and a loseR ... it's all prespective :). I've updated the web page with a little more info, but when I find the time I'll put up some

Re: [R] Spectral Analysis of Time Series in R

2008-12-05 Thread David Stoffer
You can do (1) and (2) [with some additional coding] using mvspec.R, which you can download from http://www.stat.pitt.edu/stoffer/tsa2/chap7.htm ... scroll down to the Spectral Envelope section and you'll find it there. You can look at the top part of the examples to get an idea of how to use

Re: [R] xreg in ARIMA modelling.

2008-11-27 Thread David Stoffer
The help file states: The exact likelihood is computed via a state-space representation of the ARIMA process, and the innovations and their variance found by a Kalman filter. It is possible to include exogenous variables (xreg) this way, but one can only assume this is done [only one person

[R] array in version 2.8.0

2008-11-02 Thread David Stoffer
What happened? TIA. In version 2.7.x: (x - array(1:4, c(2,2))) [,1] [,2] [1,]13 [2,]24 as.array(x) [,1] [,2] [1,]13 [2,]24 In version 2.8.0: (x - array(1:4, c(2,2))) [,1] [,2] [1,]13 [2,]24 as.array(x) Error: evaluation

Re: [R] array in version 2.8.0

2008-11-02 Thread David Stoffer
as.array in my carelessness. Sorry for waking everybody up. Rolf Turner-3 wrote: On 3/11/2008, at 2:11 PM, David Stoffer wrote: What happened? TIA. In version 2.7.x: (x - array(1:4, c(2,2))) [,1] [,2] [1,]13 [2,]24 as.array(x) [,1] [,2] [1,]13

Re: [R] Help with 'spectrum'

2008-09-12 Thread David Stoffer
Kevin- this is a simple rescaling of the axes so that the area under the curve remains constant (and is half of the variance since you only look at the positive frequencies). In this case, freq(x) = 1/dx, where dx is the time between points. It is basically a graphic device so that you get

Re: [R] arima and xreg

2008-09-11 Thread David Stoffer
multicolinearity (near or computational singularity), e.g., this fails: x = ts.intersect(mort, trend, part, part) arima(x[,1],order=c(2,0,1), xreg=x[,2:4]) Jose Capco wrote: On Sep 11, 6:24 am, David Stoffer [EMAIL PROTECTED] wrote: Your model is close, but not correct... there are no t's

Re: [R] arima and xreg

2008-09-10 Thread David Stoffer
Your model is close, but not correct... there are no t's on the parameters and the U's aren't lagged. You can find an ARMAX example on our quick fix page: http://www.stat.pitt.edu/stoffer/tsa2/R_time_series_quick_fix.htm . The example is near the bottom and just above the spectral analysis

Re: [R] Box.test degrees of freedom

2008-08-11 Thread David Stoffer
and Pierce (?Box.test for the reference). By the way, you're not alone, Minitab makes the same mistake you did. raf.rossignol wrote: David Stoffer wrote: I stand corrected. I thought I checked this a long time ago, but apparently not. tsdiag.Arima DOES NOT use the fact

Re: [R] Box.test degrees of freedom

2008-08-10 Thread David Stoffer
/Rissues.htm along with some work-arounds over here: http://www.stat.pitt.edu/stoffer/tsa2/Examples.htm David Stoffer wrote: I believe tsdiag() uses the correct degrees of freedom in applying Box.test, but the graphic shows lag on the horizontal axis when it should display degrees of freedom

Re: [R] Box.test degrees of freedom

2008-08-09 Thread David Stoffer
I believe tsdiag() uses the correct degrees of freedom in applying Box.test, but the graphic shows lag on the horizontal axis when it should display degrees of freedom. raf.rossignol wrote: Hello, Prof Brian Ripley wrote: I think you are referring to its application to the

Re: [R] Comparing complex numbers

2008-07-11 Thread David Stoffer
again for your help. Duncan Murdoch-2 wrote: On 7/11/2008 11:51 AM, David Stoffer wrote: Is there an easy way to compare complex numbers? Here is a small example: (z1=polyroot(c(1,-.4,-.45))) [1] 1.11-0i -2.00+0i (z2=polyroot(c(1,1,.25))) [1] -2+0i -2+0i x=0 if(any

Re: [R] estimate phase shift between two signals

2008-06-05 Thread David Stoffer
help(spec.pgram) - then look at the examples at the bottom of the page Dylan Beaudette-3 wrote: Hi, Are there any functions in R that could be used to estimate the phase-shift between two semi-sinusoidal vectors? Here is what I have tried so far, using the spectrum() function --

Re: [R] cross-correlation lag.plot?

2008-05-07 Thread David Stoffer
http://www.stat.pitt.edu/stoffer/tsa2/Examples.htm tom soyer wrote: Hi, Does anyone know if R has a function that is similar to lag.plot but instead of auto-correlation, it plots cross-correlation with lags? Thanks, -- Tom [[alternative HTML version deleted]]

Re: [R] Need help for calculating cross-correlation between 4 multivariate time series data

2008-03-05 Thread David Stoffer
You can use acf(), but it will be messy and the labeling of the plots is confusing and perhaps misleading... check out issue number 4 at http://www.stat.pitt.edu/stoffer/tsa2/Rissues.htm I would recommend setting up a grid of the ccfs and you could automate this (i.e., write a loop) if need

Re: [R] Kalman Filter

2008-03-04 Thread David Stoffer
Vladimir- there are at least 3 packages that will facilitate state space modeling: http://cran.r-project.org/src/contrib/Descriptions/dlm.html DLM , http://cran.r-project.org/src/contrib/Descriptions/dse.html DSE , and http://cran.r-project.org/src/contrib/Descriptions/sspir.html SSPIR . In