Polyfit with scaling - Q regarding polyval
Ben Abbott
bpabbott at mac.com
Tue Feb 5 21:45:09 CST 2008
I'm moving past polyfit, and looking into what is needed for polyval.
I'm finding that my grasp of statistics is short of what I need, and
thus, I am in need of some statistics expertise.
Matlab's polyval.m and polyconf.m each are able to provide confidence/
prediction intervals. If I grasp the intended operation of these
routines
[y, delta] = polyval (p, x, s);
is equivalent to either
[y, delta] = polyconf (p, x, s, 'alpha', 0.5, 'predopt', 'curve',
'simopt', 'off');
I'm attempting to modify Paul Kienzle's routine, polyconf.m, support
the Matlab syntax. Unfortunately, I have no idea what is intended by
"simultandous" and "nonsimultaneous" intervals ... well except that
Paul's appear to be "simultaneous" (I reached that conclusion after
Googling the subject and browsing a few papers).
For example, http://www.uwgb.edu/zornm/1997-01%20Anal.%20Chem.%2069,%203069-3075.pdf
In the paper above, eqn (3) describes the "nonsimultaneous tolerance
interval".
The routine polyconf needs to do calculate eqn (3). The routine
polyval also needs something similar, but does not require alpha to
vary (I think ... please correct me if I'm wrong).
So, I'm looking for two things.
First, I'd like a convenient way to calculate equation (3) in that
above paper for this applicaiton? I'm guessing it might look something
like this?
t = t_inv (1-alpha/2, s.df) + norminv (??) * sqrt (s.df /
chi2inv (alpha/2, s.df));
... probably not ... since it really is a wild guess on my part ;-)
Second, I'd like a confirmation that polyval is intended to return
nonsimultaneous tolerances (my comparison of Paul's polyocnf and
Matlab's polyval have led me to that guess/conclusion).
For the 2nd, if someone has a copy of Matlab's statistics toolbox
please let me know that the code below returns. ;-)
r = 0:10:50;
p = poly (r);
p = p / max(abs(p));
x = linspace(0,50,11);
y = polyval(p,x) + 0.5*rand(size(x));
[pf, s] = polyfit (x, y, numel(r));
[y1, delta1] = polyval (pf, x, s);
[y2, delta2] = polyconf (pf, x, s, 'alpha', 0.5, 'predopt', 'curve',
'simopt', 'off');
[y3, delta3] = polyconf (pf, x, s, 'alpha', 0.5, 'predopt', 'curve',
'simopt', 'on');
disp ([delta1; delta2; delta3])
TiA
Ben
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.cae.wisc.edu/pipermail/octave-maintainers/attachments/20080205/bc0f7cdf/attachment-0001.html
More information about the Octave-maintainers
mailing list