フィルターのクリア

OLS regression for multiplr Ys, Xs

3 ビュー (過去 30 日間)
Pap
Pap 2011 年 12 月 15 日
Hi all,
I need to regress multiple Ys on Xs and Zs so the model to look like:
Yij = aj+ bj*Xij+ kj*Zij
for i=1...n and j=1....256
Is there any code to do so?
Thanks in advance
Panos

採用された回答

bym
bym 2011 年 12 月 15 日
This example regresses 3 curves 'at once'. I'm sure you can adapt it to your situation
clc;clear;close all
x = sort(rand(20,1)); % independent variable
X = [ones(20,1),x,x.^2]; % vandermonde matrix
y = X*[1 2 3;2 2 3;3 3 5 ]; % dependant variable; arbitrary coefficients
y = y+rand(20,3)*.5; % add noise
coeff = X\y; % get coefficients
yhat = X*coeff; % get predictions
plot(x,yhat);hold on;
plot(x,y,'.') %plot

その他の回答 (1 件)

the cyclist
the cyclist 2011 年 12 月 15 日
The function mvregress() in the Statistics Toolbox will do this.

Community Treasure Hunt

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

Start Hunting!

Translated by