|
|
REGRESS Multiple linear regression using least squares.
6 D/ S1 K/ A6 m* {" a8 G' vB = REGRESS (Y,X)
5 H) a/ l$ D1 D# j7 W# v2 dreturns the vector B of regression coefficients in the+ q& |( a: N. ?
linear model Y = X*B.& `0 O: W3 {( M; e8 \
. {( a' T* A# ?, b1 o6 h; T4 CX is an n-by-p design matrix, with rows; X- L% E! N5 x5 b* T( b6 M8 u
corresponding to observations and columns to predictor variables.
3 H. a1 r" @. ]- ]1 q. I/ M. d
, O. t* Q; Q; Y% y+ A' kY is an n-by-1 vector of response observations.& O h; B4 u$ @9 O3 N
REGRESS' y2 x) }5 T, L6 E! k* `1 ~
多元线性回归——用最小二乘估计法4 d7 i3 X- o5 A, |8 w
B = REGRESS (Y,X) ,. R7 C3 i1 G, K4 z' C6 {
3 W9 [# F0 l* z( W返回值为线性模型Y = X*B的回归系数向量
( }0 {% w$ y( t( [ X ,n-by-p 矩阵,行对应于观测值,列对应于预测变量
! ^' e3 x3 F, W" _4 L+ ? Y ,n-by-1 向量,观测值的响应(即因变量)* H) Y# p+ l) t$ d* W, M
; S+ b. j6 u1 \0 t6 \4 z1 M[B,BINT] = REGRESS (Y,X) * F. w& z4 c1 x; Q* Q
returns a matrix BINT of 95% confidence intervals for B.
5 x0 H" G) H& c6 n! f$ O: m' uBINT,B的95%的置信区间矩阵! A$ ^( I: @# I, [: f+ Z
! z7 p4 c; n: U1 q: p) ^& r4 [[B,BINT,R] = REGRESS (Y,X): k5 J& ` y- e; B/ |7 U
returns a vector R of residuals.
8 l! O- b# o+ GR,残差向量
# M% |4 {% E6 Z
4 H& _3 f) O ]& T[B,BINT,R,RINT] = REGRESS (Y,X)
; t8 K- y7 k; t* rreturns a matrix RINT of intervals that2 [2 u [! W9 y) i
can be used to diagnose outliers.
+ F+ |+ T' S5 K9 J
$ I3 F+ U7 w O X* f: b) \& uIf RINT(i,: ) does not contain zero,
8 X% f1 H: \2 y+ N' P3 [/ A' L- v4 d H9 |3 E+ Z7 W& V
then the i-th residual is larger than would be expected, at the 5%. n3 i( w& p/ D$ R7 v
significance level.1 i( _3 T: D+ i/ `9 P1 |5 D
* [% x4 n! C9 hThis is evidence that the I-th observation is an outlier.% Q& z* I' `+ |% g5 u. ]
* \* _4 X. x0 z5 j( i& N. PRINT,区间矩阵,该矩阵可以用来诊断异常(即发现奇异观测值,译者注)。+ H) r3 H/ z7 T' ?+ L' X8 P$ Z
如果RINT(i,:)所定区间没有包含0,则第i个残差在默认的5%的显著性水平比我们所预期的要大,这可说明第i个观测值是个奇异点(即说明该点可能是错误而无意义的,如记录错误等,译者注)3 R# o9 P. j4 S9 t* D. M
! ~0 @+ k0 s" J2 S[B,BINT,R,RINT,STATS] = REGRESS (Y,X)
: }2 h7 O/ g' z3 R. Y1 o% hreturns a vector STATS containing
6 e) X" r! X1 K2 G! [" xthe R-square statistic, the F statistic and p value for the full model,and an estimate of the error variance.2 i7 C) S) v7 F
8 E; N1 i0 u+ h ?4 Y3 V; T- Q* ^ C
STATS,向量,包括R方统计量,F统计量,总模型的p值(还不清楚)和方差的一个估计(还不清楚)
% c& X% k/ S2 J5 M% B& N
: t9 g6 U1 [ s[...] = REGRESS (Y,X,ALPHA) . F! X; G1 c' n$ g
uses a 100*(1-ALPHA)% confidence level to compute BINT, and a (100*ALPHA)% significance level to compute RINT.
! V* N# y! S2 d1 k' l5 I% v用100*(1-ALPHA)%的置信水平来计算BINT,# ~$ v6 S% V; e" b h
用(100*ALPHA)%的显著性水平来计算RINT
: I* q+ z1 G) a1 r1 T( ]) {
+ U9 R7 h, z0 J F9 ^5 ^$ nX should include a column of ones so that the model contains a constant
( }- q1 r0 g: _/ x% ^term.
1 ]. f& C* o9 `* K5 H& EThe F statistic and p value are computed under the assumption
: E1 Z9 S: r) N7 m2 T( hthat the model contains a constant term, and they are not correct for
5 z% d/ ]! a3 p% zmodels without a constant.* Q6 p% t0 G2 M0 h8 _
The R-square value is one minus the ratio of
0 O5 H" n8 K) r+ j! W9 b% H$ m8 Sthe error sum of squares to the total sum of squares.6 \& q7 ~7 m M) m7 ?& h2 n) y
This value can
; u+ _, L7 {4 f1 P9 F3 R8 pbe negative for models without a constant, which indicates that the model is not appropriate for the data.
# x; ^ G" b* J3 I0 eX应该包含一个全“1”的列,这样则该模型包含常数项。F统计量和p值是在模型有常数项的假设下计算的,如果模型没有常数项,则计算得的F统计量和p值是不正确的。The R-square value is one minus the ratio of the error sum of squares to the total sum of squares.(此句无法把握,请高手帮忙~~!)若模型没有常数项,则这个值可以为负值,这也表明这个模型对数据是不合适的。(即数据不适合用多元线性模型,译者注)
* o2 ?* p0 y- w1 k
, U$ _4 _8 d/ i' J" ^. ]If columns of X are linearly dependent, REGRESS sets the maximum. F3 h8 j; b6 H1 L" N, N
possible number of elements of B to zero to obtain a "basic solution",( w: |& I/ L3 c, k- C0 Y2 s
and returns zeros in elements of BINT corresponding to the zero elements of B.- k$ y6 s8 B; W+ U
如果X的列是线性相关的,则REGRESS将使B的元素中“0”的数量尽量多,以此获得一个“基本解”,并且使B中元素“0”所对应的BINT元素为“0”。3 F( k8 ]/ r& }8 I6 \
* ~- S1 H5 J; N# k2 \REGRESS treats NaNs in X or Y as missing values, and removes them. REGRESS. j( N4 o* Y l
将X或者Y中的NaNs当作缺失值处理,并且移除它们。 |
|