[R] fft and significance
HI users, Is it possible to check the significance of peaks in a power spectrum in R Thanks and regards nuncio -- Nuncio.M Scientist National Center for Antarctic and Ocean research Head land Sada Vasco da Gamma Goa-403804 ph off 91 832 2525636 ph: cell 91 9890357423 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Significance of spectral peaks
Dear useRs, I have a time series of length approcimately 55. Is it possible to find the significance of fft spectral peaks with R? thank you -- Nuncio.M Scientist National Center for Antarctic and Ocean research Head land Sada Vasco da Gamma Goa-403804 ph off 91 832 2525636 ph: cell 91 9890357423 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] timeseries
Dear useRs, I am trying to construct a time series using as.ts function, surprisingly when I plot the data the x axis do not show the time in years, however if I use ts(data), time in years are shown in the x axis. Why such difference in the results of both the commands Thanks nuncio -- Nuncio.M Research Scientist National Center for Antarctic and Ocean research Head land Sada Vasco da Gamma Goa-403804 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] acf
Hi list, I have the following code to compute the acf of a time series acfresid <- acf(residfit), where residfit is the series when I type acfresid at the prompt the follwoing is displayed Autocorrelations of series ‘residfit’, by lag 0. 0.0833 0.1667 0.2500 0. 0.4167 0.5000 0.5833 0.6667 0.7500 0.8333 1.000 -0.015 0.010 0.099 0.048 -0.014 -0.039 -0.019 0.040 0.018 0.042 0.9167 1. 1.0833 1.1667 1.2500 1. 1.4167 1.5000 1.5833 1.6667 1.7500 0.078 -0.029 0.028 -0.016 -0.021 -0.109 0.000 -0.038 -0.006 0.015 -0.032 1.8333 1.9167 2. 2.0833 -0.002 0.014 -0.226 -0.030 Residfit is a timeseries object at monthly interval (0.0833), Here I understand R computed the correlation at lags 0 to 2 years. What is surprising to me is if I type acfresidfit at the prompt the following is displayed Autocorrelations of series ‘residfit’, by lag 0 1 2 3 4 5 6 7 8 9 10 1.000 -0.004 0.011 0.041 -0.056 0.019 -0.052 -0.027 -0.008 -0.012 -0.034 11 12 13 14 15 16 17 18 19 20 21 0.024 -0.005 0.006 -0.045 0.031 -0.035 -0.011 -0.021 -0.020 -0.010 -0.007 22 23 24 25 -0.038 0.017 0.051 0.038 >From the header I understand both are autocorrelation computed at the same lags. but the correlations are different where am I going wrong and which is the correct one. file residfit is also attached(filename-fileree2_test_out.txt) Thanks nuncio -- Nuncio.M Research Scientist National Center for Antarctic and Ocean research Head land Sada Vasco da Gamma Goa-403804 4.54540234232334 -14.4778008999506 -3.79668140611868 -7.81347830768482 -6.27293225798647 -6.87201981207487 -6.64965905122317 -6.75123982158051 18.7798275931915 6.81254237499438 17.533220743665 11.8179723199377 -13.8382453401278 3.54961036332585 -3.97203313203956 -1.11029123677042 -2.21102643268432 -1.78925830375029 -1.95531252764598 -1.90169073408017 -16.2251504389829 31.1513180684656 -5.0374856234746 3.64237537817929 35.7825921539956 -24.3131812339976 7.67437033129054 -4.57640838126481 0.13663691723 -1.678854866888 -0.980572231720623 -1.25035922801876 -23.7161201125191 5.99944860265195 6.61868629783817 -1.3221234388819 10.2414420460275 -8.47848871031044 1.63078138547826 -2.26306522145922 -0.764479820758242 -1.34245520108361 -1.12077197260524 -1.20702766721386 5.98843679322213 7.33766331906203 -2.39623468909737 0.0189595505058051 -9.7878766373797 3.90933597855122 -3.15027883357282 -0.432594130850131 -1.48003000602628 -1.07756318111729 -1.23343646676257 -1.17429968377673 13.8000693717299 6.02003887937457 -8.34195666853458 -1.11099261410632 1.56296156653197 -2.75269349211589 -0.595469082283298 -1.42707843208285 -1.10772380913903 -1.23159158432425 -1.18477973889978 -1.20369456481332 21.7239849952369 -9.66196813638387 -0.891521279149956 9.25210349671729 10.3427639242166 -9.80695249149604 2.11038354823627 -2.47972753146567 -0.713019047280778 -1.39424540580337 -1.13280146608686 31.4656314670951 -0.108909595891454 -0.451065307346077 10.56546397663 -0.647946708663838 18.1367401912301 -3.53869009989366 -2.65626056469235 -0.654807910127964 -1.42643142842822 -1.13017662852014 -1.24514893937744 -13.9208705459327 -5.42722370392831 11.5554183170163 -1.11287843661796 -3.79345702201642 -16.8470908324909 4.77680059742864 -2.61594762546361 -0.680989698404531 -1.42700689601552 -1.14061278256847 -1.25178786153672 -19.2156665052095 3.59214434723623 9.68031595123078 -0.905773257642835 11.6697859140499 -10.438203868059 -3.04292317412673 0.76333844274339 -1.99296992395689 -0.932436833094549 -1.34172353169702 -1.18500028791065 -1.2462406728489 -33.1551884101196 19.0913314431478 -6.7817942558301 5.00083912161537 -3.23440161285666 -0.80515939314185 -1.3987298644782 -1.17104115381219 -1.25960948746092 -1.22639103288181 -1.2400712072929 46.5643087168762 17.4522540549196 -10.9812432669912 10.0524952224354 -1.45992013300943 4.90518728893209 -5.35388787161763 0.342273064087802 -1.85213822475519 -1.00798494789867 -1.33394637973212 -1.20931069510199 -19.8506519887964 -28.6308445373069 5.59082974922492 6.79381059715144 -2.5896614051167 -1.29096368912288 -1.29288147655713 -1.2322294690926 -1.25647397513093 -1.2480258537729 -1.25216727045333 -1.25146060728689 -27.5730296981935 5.19481715163884 5.228853569497 -3.52768178324466 2.26390585067962 10.4196518274518 -8.93836873407259 1.70129806057068 -2.39679794286931 -0.819558553443901 -1.42782263987167 -1.19447559456423 -1.28522288490369 -14.7482003454544 14.9839484682792 -3.23392273754434 3.74619714728151 -11.0770500672262 4.03870484048016 -3.30667482507862 -0.478945510500303 -1.56875824361717 -1.14997259983422 -1.31213006657225 44.8494266790537 45.874661297 -25.3865845300823 11.7813342281731 -1.19733031473043 17.5712159736525 -13.2582237918684 3.34350682483415 -3.050508327763 -0.589138057355864 -1.53787032402965 -1.17341307292178 -8.8458687102 14.3506481320503 -4.07628087468823 4.709870521943
[R] Wavelet
Hi useRs, Is it possible to get MORLET wavelet in R Thanks nuncio -- Nuncio.M Research Scientist National Center for Antarctic and Ocean research Head land Sada Vasco da Gamma Goa-403804 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] acf significance levels
Dear useRs, How to save the correlations corresponding to the significance levels from ACF function Thanks nuncio -- Nuncio.M Research Scientist National Center for Antarctic and Ocean research Head land Sada Vasco da Gamma Goa-403804 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] tsdiag
HI list, I want to know whether tsdiag uses k-(p+q) as the lag in ljung box test. How is it possible to save those values nuncio -- Nuncio.M Research Scientist National Center for Antarctic and Ocean research Head land Sada Vasco da Gamma Goa-403804 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] auto.arima
HI list, I am using auto.arima from forecast package, I wonder whether its possible to save model orders to a seperate file Thanks nuncio -- Nuncio.M Research Scientist National Center for Antarctic and Ocean research Head land Sada Vasco da Gamma Goa-403804 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] sink function
I have the following code to write the output from auto.arima function. The issue is not in finding the model but to divert its out put fit to a file order_fit.txt. code runs but nothing is written to order_fit.txt where am I going wrong library(forecast) for (i in 1:2) { filen = paste("file",i,".txt",sep="") data <- read.table(filen) dat1 <- data[,1] xt <- ts(dat1,start=c(1978,11),end=c(2006,12),frequency=12) #dat1[dat1 == -99.989998] <- NA if (min(dat1) != max(dat1)){ fit <- auto.arima(xt,D=1) *sink(file="order_fit.txt") fit sink()* residfit <- residuals(fit) filenou1 = paste("fileree",i,"_out",".txt",sep="") residfit write.table(residfit,filenou1,sep="\t",col.names=FALSE,row.names=FALSE,quote=FALSE) }else{ *fiit <- "ARIMA(-6,-6,-6)(-6,-6,-6)[12]" sink(file="order_fit.txt") fiit sink()* filenou1 = paste("fileree",i,"_out",".txt",sep="") residfit=rep(-99.99,338) residfit write.table(residfit,filenou1,sep="\t",col.names=FALSE,row.names=FALSE,quote=FALSE) rm(data,dat1,residfit,xt) } } -- Nuncio.M Research Scientist National Center for Antarctic and Ocean research Head land Sada Vasco da Gamma Goa-403804 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] arima
HI useRs, Is it required to remove mean before using ARIMA models thanks nuncio -- Nuncio.M Research Scientist National Center for Antarctic and Ocean research Head land Sada Vasco da Gamma Goa-403804 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] removing spatial auto correlation
Hi list, I am trying to fit arima model for a grid of 360x161x338 points, where 360x161 is the spatial dimension and 338 is the number of time steps I have, which is seasonal. For this purpose I used the auto.arima function in forecast package. After fitting residuals at each grid in space, the auto correlations are still significant ( but < 0.2). This make me think that the data could be spatially correlated as well. In such case is it necesary to remove spatial autocorelations before fitting models in time and are there some methods available in R to remove the spatial autocorrelations. Thanks nuncio -- Nuncio.M Research Scientist National Center for Antarctic and Ocean research Head land Sada Vasco da Gamma Goa-403804 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] band pass filter
Hello list, Is there any way to bandpass filter in R thanks nuncio -- Nuncio.M Research Scientist National Center for Antarctic and Ocean research Head land Sada Vasco da Gamma Goa-403804 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] removing columns
Hi list, I have a matrix with all elements of some columns are zeroes. Is it possible to remove these columns and create a new matrix nuncio -- Nuncio.M Research Scientist National Center for Antarctic and Ocean research Head land Sada Vasco da Gamma Goa-403804 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] documentation in R
Dear Arun, Prof. Rob Hyndman's forecast package has automated arima. You have to install 'forecast' library for that. in linux go to r-prompt and type install.packages(). Hope this helps nuncio On Mon, Jun 13, 2011 at 12:10 PM, siddharth arun wrote: > How we can call auto.arima in R. > Is there any cran package we need to install for this function? > > -- > Siddharth Arun, > 4th Year Undergraduate student > Industrial Engineering and Management, > IIT Kharagpur > >[[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Nuncio.M Research Scientist National Center for Antarctic and Ocean research Head land Sada Vasco da Gamma Goa-403804 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] writing autocorrelation and partial auto correlation functions to a file
Dear All, I am very new to T. I need to fit a ARIMA model to my time series. So I found the auto correlation functions and partial auto correlation function in R. Now I want to save these valuse along with the significance levels to a file. How to do that?. I tried some function in R like write.table but returns an error "cannot coerce class "acf" into a data.frame". The I tried "write" but returned again an error "Error in cat(list(...), file, sep, fill, labels, append) : argument 1 (type 'list') cannot be handled by 'cat'". Where am I going wrong THanks in advance nuncio -- Nuncio.M Research Scientist National Center for Antarctic and Ocean research Head land Sada Vasco da Gamma Goa-403804 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] missing values in autocorelation
Hi all, I am trying to find the autocorrelation of some time series. I have say 100 files, some files have only missing values(-99.99, say). I dont want to exclude these files as they represent some points in a grid. But when the acf command is issued i get an error. Error in plot.window(...) : need finite 'ylim' values In addition: Warning messages: 1: In min(x) : no non-missing arguments to min; returning Inf 2: In max(x) : no non-missing arguments to max; returning -Inf Is this because of all the values in the time series is the same, if so How can I specify a bad value when the acf command is issued. Also is it possible to return a flag(like, -999) of length the maximum lag for acf of bad grid points so that I can keep the number of files same for input and output Thanks nuncio -- Nuncio.M Research Scientist National Center for Antarctic and Ocean research Head land Sada Vasco da Gamma Goa-403804 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] ARIMA order
Hi all, Is there any way in R to select the order of an ARIMA model automatically nuncio -- Nuncio.M Research Scientist National Center for Antarctic and Ocean research Head land Sada Vasco da Gamma Goa-403804 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] prewhiten
HI all., I have some univariate time series that need to be prewhitened. HOw this can be performed in R. I am thinking of to fit an ARIMA model and substract this from the original series. Is this the correct way THanks in advance nuncio -- Nuncio.M Research Scientist National Center for Antarctic and Ocean research Head land Sada Vasco da Gamma Goa-403804 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Extracting columns from a class
Hi list, I am not a frequent user of R. Recently I used R in principal component analysis and got the result as a class, which has information like standard deviation and principal components from 1 to 10. How is it possible to extract the column corresponding to first principal component and write it to a file the out from prcomp command is something like this Standard deviations: [1] 3.325801e+00 7.669837e-01 6.625773e-01 4.990732e-01 3.470071e-01 [6] 2.946679e-01 2.206289e-01 1.645828e-01 1.570887e-01 4.741294e-16 Rotation: PC1 PC2 PC3 PC4 PC5 [1,] -0.07900624 -0.0824864352 0.1208419434 0.1763425845 0.089545020 [2,] -0.09114708 -0.0901675110 0.1377608881 0.2224127252 0.076620976 [3,] -0.10510742 -0.0935434206 0.1113586044 0.2513993555 0.029783117 I want to extract PC1 and 1 value in the standard deviation Thanks -- Nuncio.M Research Scientist National Center for Antarctic and Ocean research Head land Sada Vasco da Gamma Goa-403804 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] principal components
HI all, I am trying to compute the EOF of a matrix using prcomp but unable to get the expansion co-efficients. is it possible using prcomp or are there any other methods thanks nuncio -- Nuncio.M Research Scientist National Center for Antarctic and Ocean research Head land Sada Vasco da Gamma Goa-403804 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] svd
Dear list, I searched the libraries but could not find means to compute the svd of a coupled field. Is it possible in R Thanks nuncio -- Nuncio.M Research Scientist National Center for Antarctic and Ocean research Head land Sada Vasco da Gamma Goa-403804 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] svd
Thanks juan, I got that, but what I have two matrices A and B, How can an svd be performed on the two together. Is it correct to get the covariance matrix and then perform the svd on the covariance matrix. If that is the case I have another doubt. I understand the covariance of A and B is t(A)%*%B. but this differs significantly from cov(A,B). Thanks nuncio 2011/4/4 Juan Carlos Borrás > m <- matrix(c(1:12), nrow=3, ncol=4) > svd(m) > > > > On Mon, Apr 4, 2011 at 11:51 AM, nuncio m wrote: > > Dear list, > >I searched the libraries but could not find means to compute > the > > svd of a coupled field. Is it possible in R > > > > Thanks > > nuncio > > -- > > Nuncio.M > > Research Scientist > > National Center for Antarctic and Ocean research > > Head land Sada > > Vasco da Gamma > > Goa-403804 > > > >[[alternative HTML version deleted]] > > > > __ > > R-help@r-project.org mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > > > > > -- > Cheers, > jcb! > ___ > http://twitter.com/jcborras > -- Nuncio.M Research Scientist National Center for Antarctic and Ocean research Head land Sada Vasco da Gamma Goa-403804 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.