Matlab回归说明
来源:互联网 发布:矩阵的秩的所有性质 编辑:程序博客网 时间:2024/06/01 09:29
Regress
Multiple linear regression
Syntax
[b,bint,r] = regress(y,X)
[b,bint,r,rint] = regress(y,X)
[b,bint,r,rint,stats] = regress(y,X)
[...] = regress(y,X,alpha)
Description
b = regress(y,X) returns the least squares fit of y on X by solving the linear model
for β, where:
y is an n-by-1 vector of observations
X is an n-by-p matrix of regressors
β is a p-by-1 vector of parameters
ɛ is an n-by-1 vector of random disturbances
[b,bint] = regress(y,X) returns a matrix bint of 95% confidence intervals for β.
[b,bint,r] = regress(y,X) returns a vector, r of residuals.
[b,bint,r,rint] = regress(y,X) returns a matrix rint of intervals that can be used to diagnose outliers. If rint(i,:) does not contain zero, then the ith residual is larger than would be expected, at the 5% significance level. This is evidence that the ith observation is an outlier.
[b,bint,r,rint,stats] = regress(y,X) returns a vector stats that contains the R2 statistic, the F statistic and a p value for the full model, and an estimate of the error variance.
[...] = regress(y,X,alpha) uses a 100(1 - alpha)% confidence level to compute bint, and a (100*alpha)% significance level to computerint. For example, alpha = 0.2 gives 80% confidence intervals.
X should include a column of ones so that the model contains a constant term. The F statistic and p value are computed under the assumption that the model contains a constant term, and they are not correct for models without a constant. The R-square value is one minus the ratio of the error sum of squares to the total sum of squares. This value can be negative for models without a constant, which indicates that the model is not appropriate for the data.
If the columns of X are linearly dependent, regress sets the maximum possible number of elements of B to zero to obtain a basic solution, and returns zeros in elements of bint corresponding to the zero elements of B.
regress treats NaNs in X or y as missing values, and removes them.
Examples
Suppose the true model is
where I is the identity matrix.
X = [ones(10,1) (1:10)']
X =
1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
y = X * [10;1] + normrnd(0,0.1,10,1)
y =
11.1165
12.0627
13.0075
14.0352
14.9303
16.1696
17.0059
18.1797
19.0264
20.0872
[b,bint] = regress(y,X,0.05)
b =
10.0456
1.0030
bint =
9.9165 10.1747
0.9822 1.0238
Multiple linear regression
Syntax
b = regress(y,X)
[b,bint] = regress(y,X)[b,bint,r] = regress(y,X)
[b,bint,r,rint] = regress(y,X)
[b,bint,r,rint,stats] = regress(y,X)
[...] = regress(y,X,alpha)
Description
b = regress(y,X) returns the least squares fit of y on X by solving the linear model
for β, where:
y is an n-by-1 vector of observations
X is an n-by-p matrix of regressors
β is a p-by-1 vector of parameters
ɛ is an n-by-1 vector of random disturbances
[b,bint] = regress(y,X) returns a matrix bint of 95% confidence intervals for β.
[b,bint,r] = regress(y,X) returns a vector, r of residuals.
[b,bint,r,rint] = regress(y,X) returns a matrix rint of intervals that can be used to diagnose outliers. If rint(i,:) does not contain zero, then the ith residual is larger than would be expected, at the 5% significance level. This is evidence that the ith observation is an outlier.
[b,bint,r,rint,stats] = regress(y,X) returns a vector stats that contains the R2 statistic, the F statistic and a p value for the full model, and an estimate of the error variance.
[...] = regress(y,X,alpha) uses a 100(1 - alpha)% confidence level to compute bint, and a (100*alpha)% significance level to computerint. For example, alpha = 0.2 gives 80% confidence intervals.
X should include a column of ones so that the model contains a constant term. The F statistic and p value are computed under the assumption that the model contains a constant term, and they are not correct for models without a constant. The R-square value is one minus the ratio of the error sum of squares to the total sum of squares. This value can be negative for models without a constant, which indicates that the model is not appropriate for the data.
If the columns of X are linearly dependent, regress sets the maximum possible number of elements of B to zero to obtain a basic solution, and returns zeros in elements of bint corresponding to the zero elements of B.
regress treats NaNs in X or y as missing values, and removes them.
Examples
Suppose the true model is
where I is the identity matrix.
X = [ones(10,1) (1:10)']
X =
1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
y = X * [10;1] + normrnd(0,0.1,10,1)
y =
11.1165
12.0627
13.0075
14.0352
14.9303
16.1696
17.0059
18.1797
19.0264
20.0872
[b,bint] = regress(y,X,0.05)
b =
10.0456
1.0030
bint =
9.9165 10.1747
0.9822 1.0238
Compare b to [10 1]'. Note that bint includes the true model values.
0 0
- Matlab回归说明
- MATLAB统计与回归
- 回归MATLAB和opencv
- MATLAB 线性回归
- matlab 局部加权回归
- matlab实现回归分析
- MATLAB 线性回归
- matlab 多元线性回归
- matlab实现logistic回归
- matlab线性回归程序
- MATLAB多元非线性回归
- MATLAB回归分析
- logistic 回归Matlab代码
- 线性回归代码matlab
- 线性回归(Matlab)
- matlab 线性回归
- matlab多元线性回归
- matlab Logistic回归模型
- acdream 1127 Base Station 树状数组
- NYOJ 255 C小加 之 随机数
- WPF技术触屏上的应用系列(六): 视觉冲击、超炫系统主界面、系统入口效果实现
- C语言中文件指针和文件位置指针,位置指针相关库函数
- hadoop2.4 ha(双namenode自动故障转移安装)
- Matlab回归说明
- 深入Java集合学习系列:ArrayList的实现原理
- coj 1433 Defend the Bases
- 链表应用——按字母顺序存储并输出某目录下的子文件或子目录名
- java 删除重复文件
- 【原创】Tiny6410驱动模块的构建、加载和卸载
- SystemTimeToFileTime、FileTimeToLocalFileTime、LocalFileTimeToFileTime三函数的跨平台实现
- 整形与字符型之间的相互转换
- Hive权限之审计