Mercurial > hg > octave-lyh
comparison scripts/polynomial/polyval.m @ 7501:83cce070104f
style fixes
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 20 Feb 2008 00:46:30 -0500 |
parents | 2df882e69f13 |
children | 7cbe01c21986 |
comparison
equal
deleted
inserted
replaced
7500:2df882e69f13 | 7501:83cce070104f |
---|---|
22 ## @deftypefnx {Function File} {@var{y}=} polyval (@var{p}, @var{x}, [], @var{mu}) | 22 ## @deftypefnx {Function File} {@var{y}=} polyval (@var{p}, @var{x}, [], @var{mu}) |
23 ## Evaluate the polynomial at of the specified values for @var{x}. When @var{mu} | 23 ## Evaluate the polynomial at of the specified values for @var{x}. When @var{mu} |
24 ## is present evaluate the polynomial for (@var{x}-@var{mu}(1))/@var{mu}(2). | 24 ## is present evaluate the polynomial for (@var{x}-@var{mu}(1))/@var{mu}(2). |
25 ## If @var{x} is a vector or matrix, the polynomial is evaluated for each of | 25 ## If @var{x} is a vector or matrix, the polynomial is evaluated for each of |
26 ## the elements of @var{x}. | 26 ## the elements of @var{x}. |
27 ## @deftypefnx {Function File} {[@var{y}, @var{dy}] =} polyval (@var{p}, @var{x}, @var{S}) | 27 ## @deftypefnx {Function File} {[@var{y}, @var{dy}] =} polyval (@var{p}, @var{x}, @var{s}) |
28 ## @deftypefnx {Function File} {[@var{y}, @var{dy}] =} polyval (@var{p}, @var{x}, @var{S}, @var{mu}) | 28 ## @deftypefnx {Function File} {[@var{y}, @var{dy}] =} polyval (@var{p}, @var{x}, @var{s}, @var{mu}) |
29 ## In addition to evaluating the polynomial, the second output | 29 ## In addition to evaluating the polynomial, the second output |
30 ## represents the prediction interval, @var{y} +/- @var{dy}, which | 30 ## represents the prediction interval, @var{y} +/- @var{dy}, which |
31 ## contains at least 50% of the future predictions. To calculate the | 31 ## contains at least 50% of the future predictions. To calculate the |
32 ## prediction interval, the structured variable @var{s}, originating | 32 ## prediction interval, the structured variable @var{s}, originating |
33 ## form `polyfit', must be present. | 33 ## form `polyfit', must be present. |
73 A = (x(:) * ones (1, n+1)) .^ (ones (k, 1) * (n:-1:0)); | 73 A = (x(:) * ones (1, n+1)) .^ (ones (k, 1) * (n:-1:0)); |
74 y(:) = A * p(:); | 74 y(:) = A * p(:); |
75 y = reshape (y, size (x)); | 75 y = reshape (y, size (x)); |
76 | 76 |
77 if (nargout == 2) | 77 if (nargout == 2) |
78 ## The line below is *not* the result of a conceptual grasp of statistics. | |
79 ## Instead, after reading the links below and comparing to the output of Matlab's polyval.m, | |
80 ## http://www.mathworks.com/access/helpdesk/help/toolbox/stats/index.html?/access/helpdesk/help/toolbox/stats/finv.html | |
81 ## http://www.mathworks.com/access/helpdesk/help/toolbox/curvefit/index.html?/access/helpdesk/help/toolbox/curvefit/bq_5ka6-1_1.html | |
82 ## Note: the F-Distribution is generally considered to be single-sided. | 78 ## Note: the F-Distribution is generally considered to be single-sided. |
83 ## http://www.itl.nist.gov/div898/handbook/eda/section3/eda3673.htm | 79 ## http://www.itl.nist.gov/div898/handbook/eda/section3/eda3673.htm |
84 ## t = finv (1-alpha, s.df, s.df); | 80 ## t = finv (1-alpha, s.df, s.df); |
85 ## dy = t * sqrt (1 + sumsq (A/s.R, 2)) * s.normr / sqrt (s.df) | 81 ## dy = t * sqrt (1 + sumsq (A/s.R, 2)) * s.normr / sqrt (s.df) |
86 ## If my inference is correct, then t must equal 1 for polyval. | 82 ## If my inference is correct, then t must equal 1 for polyval. |