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

Home » Public Forums » archive » Re: Equivalent of EXCEL LINEST function?
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: Equivalent of EXCEL LINEST function? [message #24781 is a reply to message #24775] Fri, 20 April 2001 17:30 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
Bruce Bowler <bbowler@bigelow.org> writes:
> So it is... now for "stupid question #347" (tm).
>
> How do I turn a vector (which is what I have for x) into an array?
>
> help, x
> x float = array[12345]
> help, y
> y float = array[12345]
> weight = replicate(1.0,n_elements(y))
> help, weight
> weight float = array[12345]
> result = regress(x,y,weight,/relative_weight)
> % REGRESS: Incompatable arrays.
>
> Looking at the code for regress, the only condition I violate to cause
> that message is that my X is only 1 dimenesion, not 2...

Probably you want to REFORM the vector into an array ( = reform(x,1,n))

However using REGRESS may be like killing a fly with a shotgun, a bit
of overkill.

Why not use LINFIT and CORRELATE, which standard IDL functions?

p = linfit(x,y, sigma=dp) ;; DP are parameter uncertainties
r2 = correlate(x,y)

Done!

Craig


--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Enter SStreams' Link of the Month Contest
Next Topic: Re: fastest operations/fctns.

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

Current Time: Wed Oct 08 19:03:59 PDT 2025

Total time taken to generate the page: 0.00424 seconds