General Linear Regression Model

Generalized form of single and multivariate regression model (linear and non-linear)
383 Descargas
Actualizado 28 ene 2016

Ver licencia

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]);

Citar como

Shoaibur Rahman (2025). General Linear Regression Model (https://la.mathworks.com/matlabcentral/fileexchange/48738-general-linear-regression-model), MATLAB Central File Exchange. Recuperado .

Compatibilidad con la versión de MATLAB
Se creó con R2014b
Compatible con cualquier versión
Compatibilidad con las plataformas
Windows macOS Linux
Categorías
Más información sobre Linear and Nonlinear Regression en Help Center y MATLAB Answers.

Community Treasure Hunt

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

Start Hunting!
Versión Publicado Notas de la versión
1.1.0.0

Fixed bugs

1.0.0.0