General Linear Regression Model

版本 1.1.0.0 (3.4 KB) 作者: Shoaibur Rahman
Generalized form of single and multivariate regression model (linear and non-linear)
380.0 次下载
更新时间 2016/1/28

查看许可证

out = GenRegModel(x,y, deg) returns a linear regression fit of y using variables x with a polynomial degree defined by deg. By default deg = 1. Each column of x represents a separate regressor of the model. y is a colum vector, which is to be estimated by regression.
The output is saved in out as a structured form:out.b contains the coefficients of the polynomial models as columns out.model is the model equation out.y_hat is estimate of all y variables as column vectors

out.SSE: sum of squared error for models of each variables in y
out.SST: sum of squared total for models of each variables in y
out.SSR: sum of squared regression for models of each variables in y
out.R2: R-squared measurement for models of each variables in y
out.KL: measure of Kullback-Leibler (KL) divergence for models of each variables in y

out = genRegModel(x,y,deg,setb,bvalue) allows to set one or more coefficients to specific value(s). setb is an array of the indices of variables, which weights are pre-set, whereas bvalue is the array of those pre-set values. For example, if we do not want the constant term in our equation, then setb = 0, the first index, and bvalue = 0, no weight to constant. Mare sure to define deg even if this is 1 in this case!

Examples
x1 = random('uniform',1,10,[100,1]);
x2 = random('uniform',1,10,[100,1]);
y = (1./x1+1./x2).^(-1)+abs(random('normal',0,1,[100 1]));
out1 = genRegModel([x1 x2],y,1);
out2 = genRegModel([x1 x2],y,2,[0 2],[0,1]);

引用格式

Shoaibur Rahman (2024). General Linear Regression Model (https://www.mathworks.com/matlabcentral/fileexchange/48738-general-linear-regression-model), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2014b
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Linear and Nonlinear Regression 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.1.0.0

Fixed bugs

1.0.0.0