regressmultiplelinearregressionusingleastsquares。
使用最小二乘法多元线性回归。
1.b=regress(y,x ) returnsthevectorbofregressioncoefficientsinthelinearmodely=x * b.xisa nnn-by-pdesignmatrix, withrowscorrespondingtoobservationsandcolumnstopredictorvariables.yisan-by-1 vectorofresponseobservations。
返回线性模型Y=X*B的拟合系数向量b。 x为设计的n x p矩阵,该行对应于观测值,列对应于预测值。 y是n x 1的观测的响应向量。
2. [B,bint]=regress(y,x ) returnsamatrixbintof 95 % confidenceintervalsforb。
返回表示矩阵b的95%置信区间的矩阵BINT。
3. [B,BINT,r]=regress(y,x ) returns a vector R of residuals .
返回残差向量r
4. [B,BINT,r,rint]=regress(y,x ) returnsamatrixrintofintervalsthatcanbeusedtodiagnoseoutliers.IFR int ] I, then thei-thresidualislargerthanwouldbeexpected,at the5% significance level.thisisevidencethatthei-thobservationisationisation
返回可以诊断异常值的区间矩阵RINT,如果RINT的第I行没有0,则第I行的残差大于预计的5%的显著水平。 这证明了I行的观测值偏离了。
5. [B,BINT,r,RINT,stats]=regress(y,x ) returns a vector STATS containing,inthe following order,ther-square stats
返回值的向量STATS如下所示:
6.[.]=regress(y,x,ALPHA ) usesa100*(1-alpha ) % confidence level to compute BINT,anda ) 100*alpha ) signiff
用100*(1-) %的可靠度计算BINT,计算100%的
xshouldincludeacolumnofonessothatthemodelcontainsaconstantterm.thefstatisticandpvaluearecomputedundertheassumptionthattthemo m, andtheyarenotcorrectformodelswithoutaconstant.ther-squarevalueisoneminustheratiooftheerrorsumofsquarestotalsumofsquara rmodelswithoutaconstant,whichindicatesthatthemodelisnotappropriateforthedata。
ifcolumnsofxarelinearlydependent,regresssetsthemaximumpossiblenumberofelementsofbtozerotoobtaina ' basic solution ',ande
如果所有的x列都是线性相关的,则REGRESS
regresstreatsnans(notanumber ) in X or Y as missing values,and removes them。
拟合函数认为对于x或y中的非数值要素,他们有欠缺,所以删除他们。