Forum: Ruby Power Trend Line

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
0de83fd56f1af530034ba8efa5490b1b?d=identicon&s=25 John Butler (johnnybutler7)
on 2008-11-14 12:27
Hi,

Im using some graphing software to produce charts which contain various
lines.  One line i need to produce is a power trend line from an array
dataset.  Has anyone had any experience of this in ruby?

JB
A8486651a974d7d9ecc35d25de96c7ee?d=identicon&s=25 Chris Lowis (chrislo)
on 2008-11-16 19:30
> Im using some graphing software to produce charts which contain various
> lines.  One line i need to produce is a power trend line from an array
> dataset.  Has anyone had any experience of this in ruby?

One approach would be to use the fitting libraries provided by the GSL:
http://www.gnu.org/software/gsl/manual/html_node/L...

To access this from Ruby you can use the Ruby GSL bindings :
http://rb-gsl.rubyforge.org/

Another approach may be to use the Ruby/R interface RRRuby :
http://rubyforge.org/projects/rsruby/

although, unless you have a compelling reason to use Ruby (such as
integrating with existing code) you may find it better to use R directly
(http://www.r-project.org/).

If you have some sample data or code perhaps we can come up with some
examples,

Hope this helps,

Chris
D0338c0de4cb3c5c17300396159933d1?d=identicon&s=25 Axel Etzold (Guest)
on 2008-11-17 00:15
(Received via mailing list)
-------- Original-Nachricht --------
> Datum: Fri, 14 Nov 2008 20:24:01 +0900
> Von: John Butler <johnnybutler7@gmail.com>
> An: ruby-talk@ruby-lang.org
> Betreff: Power Trend Line

> Hi,
>
> Im using some graphing software to produce charts which contain various
> lines.  One line i need to produce is a power trend line from an array
> dataset.  Has anyone had any experience of this in ruby?
>
> JB
> --
> Posted via http://www.ruby-forum.com/.

Dear John,

maybe gruff is for you ?

http://nubyonrails.com/pages/gruff

Best regards,

Axel
A8486651a974d7d9ecc35d25de96c7ee?d=identicon&s=25 Chris Lowis (chrislo)
on 2008-11-17 00:25
> maybe gruff is for you ?
>
> http://nubyonrails.com/pages/gruff

I interpreted the original message to mean code to fit a, for example,
polynomial of a given order to some data. It's been a while since I
played with it but can Gruff do this ?

Chris
D0338c0de4cb3c5c17300396159933d1?d=identicon&s=25 Axel Etzold (Guest)
on 2008-11-17 01:08
(Received via mailing list)
Dear Chris,


>> Im using some graphing software to produce charts which contain various
>> lines.  One line i need to produce is a power trend line from an array
>> dataset.

>
> I interpreted the original message to mean code to fit a, for example,
> polynomial of a given order to some data. It's been a while since I
> played with it but can Gruff do this ?

No, I don't think so, it's just for graphing (and for lines, rather than
polynomials)
rather than fitting, for which the software you proposed can be used.
Maybe you're right that the OP wanted some fitting algorithm.

A good place to look for is "Linear Regression" (can be used also to
determine
coefficients of polynomials). There is an example for Rb-gsl here:

http://rb-gsl.rubyforge.org/fit.html#2 , chapter 5 .

Once you've calculated it, you can choose a nice graphing output
software ...

Best regards,

Axel
This topic is locked and can not be replied to.