Programmer Guide/Command Reference/EVAL/rpolyreg: Difference between revisions

From STX Wiki
Jump to navigationJump to search
m (1 revision: Initial import)
No edit summary
 
(14 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
=====rpolyreg=====
Linear, multivariant and polynominal regression.
----
;Usage 1: <code>rpolyreg(<var>x<sub>vector</sub></var>, <var>y<sub>vector</sub></var> {, <var>m</var>})</code>:
:;<var>x</var>: ''x'' data vector
:;<var>y</var>: y data vector: <code>''y''[i] = f(''x''[i] {, ''x''[i]^2, .., ''x''[i]^''m''})</code>
:;<var>m</var>: the regression (polynom) order; m>0 (default=1)
;Result 1: Approximate the function ''y'' using polynominal regression. The result is the vector ''r'' with the ''m''+1 coefficients of the regression polynom.
::<code>''y''<sub>REG</sub>[i] = ''r''[0] + ''r''[1]*''x''[i] {+ ''r''[2]*''x''[i]^2 + .. + ''r''[''m'']*''x''[i]^''m''}</code>
----
;Usage 2: <code>rpolyreg(<var>x<sub>matrix</sub></var>, <var>y<sub>vector</sub></var> {, <var>m</var>})</code>:
:;<var>x</var>: ''x'' data matrix, the regression order is the number of independent variables <code>''m''=ncol(''x'')</code>
:;<var>y</var>: ''y'' data vector: <code>''y''[i] = f(''x''[i,*])</code>
;Result 2: Approximate the function ''y'' using multivariant linear regression. The result is the vector ''r'' with the ''m''+1 regression coefficients.
::<code>''y''<sub>REG</sub>[i] = ''r''[0] + ''r''[1]*''x''[i,0] + .. + ''r''[''m'']*''x''[i,''m''-1]</code>
----
;See also: [[../rpoly|rpoly]], [[../interp|interp]], [[../rleqs|rleqs, cleqs]], [[../svd|svd]]


Computes the polynomial regression coefficients of order <var>m</var> for the function <code>y=f(</code><var>x</var><code>)</code>.
[[../#Functions|<function list>]]
 
=====Usage:=====
 
<code>rpolyreg(<var>m</var>, <var>y</var>, {<var>x</var>})</code>
 
=====Parameters:=====
 
;<var>m</var>
 
:The regression order (<code>1</code>=linear etc).
 
;<var>y</var>
 
:The y data vector.
 
;<var>x</var>
 
:The x data vector. If <var>x</var> is not supplied, then <var>x</var><code>[i]</code> is set to the value of <code>i</code>.
 
=====Result:=====
 
The regression coefficients - a vector with <var>m</var><code>+1</code> elements.
 
=====Return Type:=====
 
A vector.

Latest revision as of 12:38, 21 April 2011

Linear, multivariant and polynominal regression.


Usage 1
rpolyreg(xvector, yvector {, m}):
x
x data vector
y
y data vector: y[i] = f(x[i] {, x[i]^2, .., x[i]^m})
m
the regression (polynom) order; m>0 (default=1)
Result 1
Approximate the function y using polynominal regression. The result is the vector r with the m+1 coefficients of the regression polynom.
yREG[i] = r[0] + r[1]*x[i] {+ r[2]*x[i]^2 + .. + r[m]*x[i]^m}

Usage 2
rpolyreg(xmatrix, yvector {, m}):
x
x data matrix, the regression order is the number of independent variables m=ncol(x)
y
y data vector: y[i] = f(x[i,*])
Result 2
Approximate the function y using multivariant linear regression. The result is the vector r with the m+1 regression coefficients.
yREG[i] = r[0] + r[1]*x[i,0] + .. + r[m]*x[i,m-1]

See also
rpoly, interp, rleqs, cleqs, svd

<function list>

Navigation menu

Personal tools