Re: [R] squared coherency and cross-spectrum

2005-12-05 Thread Ling Jin
Thanks for the information. I tried to use coherency to look at 
correlations of two time series at different time scales. More 
specifically, on what time scale, my model predictions are more coherent 
with the observed values.

Ling

Spencer Graves wrote:

   I haven't seen a reply, so I will comment even though I've never 
 used coherency / coherence nor spectrum.  
 RSiteSearch(coherence) produced 13 hits, the third of which looked 
 like it might be relevant to your question 
 (http://finzi.psych.upenn.edu/R/Rhelp02a/archive/37640.html). 
 RSiteSearch(coherency) produced 12 hits, at least some of which look 
 like they might help you.  In my cursory review, it looked like at 
 least one of the coherence / coherency hits also mentioned the 
 co-spectrum.  Whether that's true or not, the examples with 
 ?spectrum includes the statement, for multivariate examples see the 
 help for spec.pgram.  If you still have a question for this listserve 
 after reviewing these references, PLEASE do read the posting guide! 
 'www.R-project.org/posting-guide.html'.  I believe that people who 
 follow more closely that posting guide tend to receive quicker, more 
 useful answers than those who don't.

   I hope you won't mind if I now ask you a question:  What can you 
 get from coherency and co-spectrum that you can't get as easily 
 from autocorrelation and partial autocorrelation functions, including 
 the cross-correlations?

   hope this helps.
   spencer graves

 Ling Jin wrote:

 Hi All,

 I have two time series, each has length 354. I tried to calculate the 
 coherency^2 between them, but the value I got is always 1. On a 
 website, it says:  Note that if the ensemble averaging were to be 
 omitted, the coherency (squared) would be 1, independent of the 
 data. Does any of you know how to specify properly in R in order to 
 get more useful coherency? The examples in the help do give 
 coherencies that are not 1s, but I did not notice any special 
 specification.

 Next question is on co-spectrum. When I supply spectrum function 
 with multiple time series, it only gives me spectrum (smoothed 
 periodogram) of individual time series. Is there any way I can get 
 the cross-spectrum? I believe R has calculated it, but I could not 
 find in the returned values.

 Attached is the smoothed periodogram of the two time series.

 Thanks a lot!

 Ling


 


 

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html



__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] squared coherency and cross-spectrum

2005-12-01 Thread Ling Jin

Hi All,

I have two time series, each has length 354. I tried to calculate the 
coherency^2 between them, but the value I got is always 1. On a website, 
it says:  Note that if the ensemble averaging were to be omitted, the 
coherency (squared) would be 1, independent of the data. Does any of 
you know how to specify properly in R in order to get more useful 
coherency? The examples in the help do give coherencies that are not 1s, 
but I did not notice any special specification.


Next question is on co-spectrum. When I supply spectrum function with 
multiple time series, it only gives me spectrum (smoothed periodogram) 
of individual time series. Is there any way I can get the 
cross-spectrum? I believe R has calculated it, but I could not find in 
the returned values.


Attached is the smoothed periodogram of the two time series.

Thanks a lot!

Ling


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

[R] cospectrum

2005-11-29 Thread Ling Jin
Hi, Does anyone know which function in R can compute cross-spectrum of 
two time series, and what lib is needed? I found ccf, which only gives 
cross-correlation. I need to carry that further by doing a Fourier 
transform.

Thanks,

Ling

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] merge

2005-07-08 Thread Ling Jin
Hi all,

I have two data frames to merge by a column containing the site names 
(as characters). However, somehow, one of the site names of one data 
frame have fixed length, say 8, so the names sometimes have spaces at 
the end. For example, the site name is ST, but in one data frame, it 
is ST. Therefore, the merge function won't recognize that ST 
and STare the same, so won't merge accordingly.

Is there a easy way to deal with it? Or I should do something during 
data import? (BTW, I imported the data using read.csv)


Thanks!

Ling

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] How to sort a dataset by one column?

2005-06-22 Thread Ling Jin
I understand how to sort a vector, but I could not find how to sort a 
data frame or matrix by one variable (column). Could you give me some 
examples? Thanks!

Ling

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] How to read an excel data into R?

2005-06-22 Thread Ling Jin
Hi all,

Does anybody know the easiest way to import excel data into R? I copied 
and pasted the excel data into a txt file, and tried read.table, but R 
reported that

Error in read.table(data_support.txt, sep =  , header = T) :
 more columns than column names

Thanks!

Ling

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html