Sponsored Content
Full Discussion: Middled Rolling average
Top Forums UNIX for Dummies Questions & Answers Middled Rolling average Post 302960365 by Indra2011 on Saturday 14th of November 2015 11:01:08 AM
Old 11-14-2015
Yes, RudiC, I don't want the zero to be part of the computation.

Thanks
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Rolling back time

Hi all, Have a small problem. Back in October the pervious sys-admin (of a client's company) made the necessary adjustments to the system clock for daylight savings (Sydney time - +11 GMT). As far as I can gather, they just amended the time - NO TIMEZONE !?! Is there an effective and safe... (5 Replies)
Discussion started by: Cameron
5 Replies

2. UNIX for Dummies Questions & Answers

average value

If I have a file like this, could anyone please guide me how to find the average value in each metrix. The file has got about 130,000 metrixs. Grid-ref= 142, 235 178 182 203 240 273 295 289 293 283 262 201 176 167 187 187 246 260 282 299 312 293 276 230 191 169 ... (2 Replies)
Discussion started by: su_in99
2 Replies

3. Shell Programming and Scripting

count average

Hi Friends, Can any one help me with count average of student marks in this file (i can not change structure of the input file): input file: 1 - student ID 2 - student name 3 - group ID 4 - teacher ID 5 - marks (numbers of marks are different) 1:John Smith:2:3:2 3 4 5 2:Mark... (1 Reply)
Discussion started by: mleplawy
1 Replies

4. Shell Programming and Scripting

log rolling

Hi, I'm thinking of running a script via cron (every hour) to do the log rolling. The file is "file.txt" and there going to be 10 files rolling (file.txt.n). The file is being written constantly by an application. The script will do the following: 1. cat file.txt > file.txt.0 2. cat... (0 Replies)
Discussion started by: chaandana
0 Replies

5. AIX

rolling back Technology Level

Hi, is it possible to roll back currently updated Technology level ? what are steps required? Regards, Manoj (2 Replies)
Discussion started by: manoj.solaris
2 Replies

6. Linux

Rolling Back an Update

I am writing a software product and hope that it will work on a variety of Linux distributions. At the moment, I am trying to create some kind of Linux version of patches/upgrades of installed software. Gathering information on available updates isn't hard, nor is installation of updates, but I... (27 Replies)
Discussion started by: Brandon9000
27 Replies

7. UNIX for Dummies Questions & Answers

Rolling back SQL transaction

Can some one help me related to .sql file issue. I have a .sqlfile and tried to read the file thru unix. In the .sqlfile I have error rows as well and when error comes I dont want to proceed further and need to roll back all the transactions. sample .sql file below insert into test... (2 Replies)
Discussion started by: sri_aue
2 Replies

8. UNIX for Advanced & Expert Users

Want to get average value for each hour

I want to get CPU average value only (not required user CPU & memory) with each hours on individual date. The sample output is below | | | User |Memory| User | Date | Time |CPU %|CPU % | % |Mem % | 03/02/2015|00:00:00| 24.56| 20.66| 89.75| 63.48|... (13 Replies)
Discussion started by: Saravanan_0074
13 Replies

9. Shell Programming and Scripting

Get average and percentage non zero value

How to calculate percentage non zero value occurrence base on value col 1 and 2 2017 a 0 2017 a 2 2017 a 4 2017 a 2 2017 a 0 2017 b 2 2017 b 6 2016 a 2 2016 a 2 2016 b 2 2016 b 8 2016 b 0 2016 b 0 2016 c 2 2016 c 2 2016 c 0 i manage to get average # awk '{A++;B+=$3}END{for(X in... (1 Reply)
Discussion started by: before4
1 Replies
Statistics::Basic::LeastSquareFit(3pm)			User Contributed Perl Documentation		    Statistics::Basic::LeastSquareFit(3pm)

NAME
Statistics::Basic::LeastSquareFit - find the least square fit for two lists SYNOPSIS
A machine to calculate the Least Square Fit of given vectors x and y. The module returns the alpha and beta filling this formula: $y = $beta * $x + $alpha for a given set of x and y co-ordinate pairs. Say you have the set of Cartesian coordinates: my @points = ( [1,1], [2,2], [3,3], [4,4] ); The simplest way to find the LSF is as follows: my $lsf = lsf()->set_size(int @points); $lsf->insert(@$_) for @points; Or this way: my $xv = vector( map {$_->[0]} @points ); my $yv = vector( map {$_->[1]} @points ); my $lsf = lsf($xv, $yv); And then either query the values or print them like so: print "The LSF for $xv and $yv: $lsf "; my ($yint, $slope) = my ($alpha, $beta) = $lsf->query; LSF is meant for finding a line of best fit. $beta is the slope of the line and $alpha is the y-offset. Suppose you want to draw the line. Use these to calculate the "x" for a given "y" or vice versa: my $y = $lsf->y_given_x( 7 ); my $x = $lsf->x_given_y( 7 ); (Note that "x_given_y()" can sometimes produce a divide-by-zero error since it has to divide by the $beta.) Create a 20 point "moving" LSF like so: use Statistics::Basic qw(:all nofill); my $sth = $dbh->prepare("select x,y from points where something"); my $len = 20; my $lsf = lsf()->set_size($len); $sth->execute or die $dbh->errstr; $sth->bind_columns( my ($x, $y) ) or die $dbh->errstr; my $count = $len; while( $sth->fetch ) { $lsf->insert( $x, $y ); if( defined( my ($yint, $slope) = $lsf->query ) { print "LSF: y= $slope*x + $yint "; } # This would also work: # print "$lsf " if $lsf->query_filled; } METHODS
This list of methods skips the methods inherited from Statistics::Basic::_TwoVectorBase (things like insert(), and ginsert()). new() Create a new Statistics::Basic::LeastSquareFit object. This function takes two arguments -- which can either be arrayrefs or Statistics::Basic::Vector objects. This function is called when the leastsquarefirt() shortcut-function is called. query() LSF is meant for finding a line of best fit. $beta is the slope of the line and $alpha is the y-offset. my ($alpha, $beta) = $lsf->query; y_given_x() Automatically calculate the y-value on the line for a given x-value. my $y = $lsf->y_given_x( 7 ); x_given_y() Automatically calculate the x-value on the line for a given y-value. my $x = $lsf->x_given_y( 7 ); "x_given_y()" can sometimes produce a divide-by-zero error since it has to divide by the $beta. This might be helpful: if( defined( my $x = eval { $lsf->x_given_y(7) } ) ) { warn "there is no x value for 7"; } else { print "x (given y=7): $x "; } query_vector1() Return the Statistics::Basic::Vector for the first vector used in the computation of alpha and beta. query_vector2() Return the Statistics::Basic::Vector object for the second vector used in the computation of alpha and beta. query_mean1() Returns the Statistics::Basic::Mean object for the first vector used in the computation of alpha and beta. query_variance1() Returns the Statistics::Basic::Variance object for the first vector used in the computation of alpha and beta. query_covariance() Returns the Statistics::Basic::Covariance object used in the computation of alpha and beta. OVERLOADS
This object is overloaded. It tries to return an appropriate string for the calculation, but raises an error in numeric context. In boolean context, this object is always true (even when empty). AUTHOR
Paul Miller "<jettero@cpan.org>" COPYRIGHT
Copyright 2012 Paul Miller -- Licensed under the LGPL SEE ALSO
perl(1), Statistics::Basic, Statistics::Basic::_TwoVectorBase, Statistics::Basic::Vector perl v5.14.2 2012-01-23 Statistics::Basic::LeastSquareFit(3pm)
All times are GMT -4. The time now is 03:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy