两个函数的用途就不一样的。
判断误差区两端,都大于0或都小于0的点要舍去
r就是残差值,也就是原点对应的值,是一列数据
而rint是残差值的区间,也就是误差条最小和最大值,是两列数据
mask=(rint(:,1).*rint(:,2)<0); %取得残差区间两端符号相反的逻辑矩阵(两端异号,符合要求)
ynew=y(mask); %假设y是原来做回归时用的y数据
Xnew=X(mask,:); %假设X是原来做回归时用的X数据
ynew和xnew就是剔除了坏点之后的数据
多元线性回归方程中当涉及的自变量较多时,这些自变量可能并不是全部都对应变量有显著影响,同时有些自变量之间也可能相关
- b = regress(y,X) returns the least squares fit of y on X
by solving the linear model
判断误差区两端,都大于0或都小于0的点要舍去
r就是残差值,也就是原点对应的值,是一列数据
而rint是残差值的区间,也就是误差条最小和最大值,是两列数据
mask=(rint(:,1).*rint(:,2)<0); %取得残差区间两端符号相反的逻辑矩阵(两端异号,符合要求)
ynew=y(mask); %假设y是原来做回归时用的y数据
Xnew=X(mask,:); %假设X是原来做回归时用的X数据
ynew和xnew就是剔除了坏点之后的数据
- stepwise(X,y) displays an interactive tool for creating a regression model to predict the vector y, using a subset of the predictors given by columns of the matrix X. Initially, no predictors are included in the model, but you can click predictors to switch them into and out of the model.
多元线性回归方程中当涉及的自变量较多时,这些自变量可能并不是全部都对应变量有显著影响,同时有些自变量之间也可能相关
