comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: How to plot linear regression relation of two array?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: How to plot linear regression relation of two array? [message #65041 is a reply to message #65040] Mon, 09 February 2009 13:20 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Hu writes:

> Yes, I use function linfit() to get the parameters a and b (Y=3Da+b*X)
> But How can I get the R^2 ?

R is the correlation coefficient. I typically get
it from CORRELATE:

params = LinFit(x, y, /DOUBLE)
r = Correlate(x, y, /DOUBLE)
r_sqrd = r^2

You can put it on to your plot with XYOUTS:

XYOUTS, 0.1, 0.9, /NORMAL, 'R^2 = ' + $
StrTrim(String(r_sqrd, FORMAT='(F8.2)'),2)

Cheers,

David

--
David Fanning, Ph.D.
Coyote's Guide to IDL Programming (www.dfanning.com)
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to plot linear regression relation of two array?
Next Topic: Re: Cursor in Mac OS X 10.5.6 w/X11 2.2.3 and 2.3.2

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 06:02:38 PDT 2025

Total time taken to generate the page: 0.32117 seconds