[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #39938] pkg statistics: make qqplot ML compati
From: |
Muhali |
Subject: |
[Octave-bug-tracker] [bug #39938] pkg statistics: make qqplot ML compatible |
Date: |
Wed, 04 Sep 2013 08:45:03 +0000 |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:23.0) Gecko/20100101 Firefox/23.0 |
URL:
<http://savannah.gnu.org/bugs/?39938>
Summary: pkg statistics: make qqplot ML compatible
Project: GNU Octave
Submitted by: muhali
Submitted on: Wed 04 Sep 2013 01:45:03 AM PDT
Category: Octave Forge Package
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Matlab Compatibility
Status: None
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: dev
Operating System: GNU/Linux
_______________________________________________________
Details:
The attached patch makes qqplot accept a data array as a second argument, as
in ML. Its empirical quantiles are used for the plot.
--- /a/qqplot.m
+++ /b/qqplot.m
@@ -18,8 +18,9 @@
## -*- texinfo -*-
## @deftypefn {Function File} address@hidden, @var{s}] =} qqplot (@var{x})
+## @deftypefnx {Function File} address@hidden, @var{s}] =} qqplot (@var{x},
@var{y})
## @deftypefnx {Function File} address@hidden, @var{s}] =} qqplot (@var{x},
@var{dist})
-## @deftypefnx {Function File} address@hidden, @var{s}] =} qqplot (@var{x},
@var{dist}, @var{params})
+## @deftypefnx {Function File} address@hidden, @var{s}] =} qqplot (@var{x},
@var{y}, @var{params})
## @deftypefnx {Function File} {} qqplot (@dots{})
## Perform a QQ-plot (quantile plot).
##
@@ -29,6 +30,9 @@
## largest element of x versus abscissa @var{q}(@var{i}f) = G((@var{i} -
## 0.5)/@var{n}).
##
+## If the second argument is a vector @var{y} the empirical CDF of @var{y}
+## is used as @var{dist}.
+##
## If the sample comes from F, except for a transformation of location
## and scale, the pairs will approximately follow a straight line.
##
@@ -65,7 +69,13 @@
if (nargin == 1)
f = @stdnormal_inv;
else
- if ( exist (invname = sprintf ("%sinv", dist))
+ if ( isvector(dist) )
+ if ( exist("empirical_inv") == 2 )
+ f = @(y) empirical_inv(y, dist) ;
+ else
+ f = @(y) empiricalinv(y, dist) ;
+ endif
+ elseif( exist (invname = sprintf ("%sinv", dist))
|| exist (invname = sprintf ("%s_inv", dist)))
f = str2func (invname);
else
@@ -92,6 +102,7 @@
if (nargout == 0)
plot (q, s);
+ q_label = strrep(q_label, "_", "\_") ;
xlabel (q_label);
ylabel ("sample points");
endif
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?39938>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #39938] pkg statistics: make qqplot ML compatible,
Muhali <=