octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[dataframe] useability with statistics/base


From: CdeMills
Subject: [dataframe] useability with statistics/base
Date: Fri, 10 Dec 2010 06:44:28 -0800 (PST)

Hello,

most of the functions from base stats, like mean, std, ... now work on
dataframe without any modifications, as the operators are overloaded. There
are two issues though:
- quantile.m, through its __quantile__.m internal function, tries to assign
the result of computations on its input to a matrix; see the other posting.
I hacked it through the overloaded 'sort' function: it it detects that
'quantile' is part of the calling stack, the dataframe is converted back to
an array
- there are some functions, like skewness, where the output is explicitely
initialised by calling zeros(...), then determining where the result makes
sense, and filling those values with a last computation:

  retval = zeros (sz);
  s = std (x, [], dim);
  ind = find(s > 0);
  x = sum (x .^ 3, dim);
  retval(ind) = x(ind) ./ (c * s(ind) .^ 3);

This way, only colums where standard deviation is not null are filled. Would
it break other applications to rewrite it as:
  s = std (x, [], dim);
  ind = s > 0;
  retval = sum (x .^ 3, dim);
  retval(ind) = retval(ind) ./ (c * s(ind) .^ 3);
  retval(~ind) = 0;

The  idea is that 'retval' and 's' are of the same class as x; the
computation is performed through the overloaded mrdivide operator, while, at
the last line, problematic values are replaced by zero through the class
subsasgn method, which will take care about the issues of conversion and
casting. 

The goal is to have functions from 'statistics' be aware of their input
class, transparently returning a result of the same class. Any objections ?
Questions ? ... ? 

Regards

Pascal


-- 
View this message in context: 
http://octave.1599824.n4.nabble.com/dataframe-useability-with-statistics-base-tp3082082p3082082.html
Sent from the Octave - Maintainers mailing list archive at Nabble.com.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]