General Linear Regression Model
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]);
Zitieren als
Shoaibur Rahman (2024). General Linear Regression Model (https://www.mathworks.com/matlabcentral/fileexchange/48738-general-linear-regression-model), MATLAB Central File Exchange. Abgerufen.
Kompatibilität der MATLAB-Version
Plattform-Kompatibilität
Windows macOS LinuxKategorien
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Live Editor erkunden
Erstellen Sie Skripte mit Code, Ausgabe und formatiertem Text in einem einzigen ausführbaren Dokument.
Version | Veröffentlicht | Versionshinweise | |
---|---|---|---|
1.1.0.0 | Fixed bugs |
||
1.0.0.0 |