Re: CORRELATE where is the problem? [message #65471] |
Sun, 08 March 2009 12:39  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
xiao writes:
> Hi~ everyone. I have a simple question here. I have two arrays and I
> calculated the correlation between them. The result is 0.49. But when
> I use the equation to calculate the correlation. The result is 0.99.
> And I can see from the plot that they are actually highly correlated.
> Why is that? THX
>
> openr,1,'data.txt'
> data=fltarr(2,1227)
> readf,1,data
>
> temp=data(1,*)
> oo=data(0,*)
> ;print,temp(0)
>
> temp=reform(temp)
> oo=reform(oo)
>
> corr=CORRELATE(oo,temp)
> print,corr
> rr=LINFIT(temp,oo)
> print,rr
> plot,psym=2,temp,oo
Which equation are you talking about? My guess is
you have constructed the equation incorrectly.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: CORRELATE where is the problem? [message #65569 is a reply to message #65471] |
Sun, 08 March 2009 13:35  |
xiao zhang
Messages: 81 Registered: June 2008
|
Member |
|
|
I used the equation in this link:
http://www.jerrydallal.com/LHSP/corr.htm
but the result is different from IDL :(
Xiao
On Mar 8, 2:39 pm, David Fanning <n...@dfanning.com> wrote:
> xiao writes:
>> Hi~ everyone. I have a simple question here. I have two arrays and I
>> calculated the correlation between them. The result is 0.49. But when
>> I use the equation to calculate the correlation. The result is 0.99.
>> And I can see from the plot that they are actually highly correlated.
>> Why is that? THX
>
>> openr,1,'data.txt'
>> data=fltarr(2,1227)
>> readf,1,data
>
>> temp=data(1,*)
>> oo=data(0,*)
>> ;print,temp(0)
>
>> temp=reform(temp)
>> oo=reform(oo)
>
>> corr=CORRELATE(oo,temp)
>> print,corr
>> rr=LINFIT(temp,oo)
>> print,rr
>> plot,psym=2,temp,oo
>
> Which equation are you talking about? My guess is
> you have constructed the equation incorrectly.
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|