solving general linear models

조회 수: 2 (최근 30일)
Richard
Richard 2012년 4월 3일
I need to solve a general linear model in the form of
Y = X*C+E to calibrate a load-cell. I can not measure the individual force and torques independently, such that I could use functions like regress().
The model looks like this : [F_x,F_y,F_z,T_x,T_y,T_z;... n observations] = [V1,V2,V3,V4,V5,V6;...n observations]*C + Error
What is the best solution in Matlab to perform a linear regression and solve for the 6x6 calibration matrix C?
I don't want to use the pseudo-inverse, as the voltage measurements might be erroneous.

채택된 답변

Tom Lane
Tom Lane 2012년 4월 4일
The mvregress function comes at this a little differently, but it is possible to set up the problem using mvregress. For this sample problem:
n = 100; p = 3; d = 4;
x = randn(n,p);
c = rand(p,d)
e = randn(n,d)/10;
y = x*c + e;
I can use backlash to get a matrix of coefficients:
x\y
and I can get the same coefficients from mvregress this way:
for j=1:n; X{j} = kron(eye(d),x(j,:)); end
mvregress(X,y)
This will give you some additional outputs, though not all you may be looking for. For example, the fourth output is the estimated covariance of the coefficient estimates, so you can take the square root of the diagonal values to get standard errors.
  댓글 수: 1
Richard
Richard 2012년 4월 4일
Thank you Tom, that is what I was looking for. I've found a similar example for the mvregress-function but could not actually look through it.

댓글을 달려면 로그인하십시오.

추가 답변 (3개)

Tom Lane
Tom Lane 2012년 4월 4일
I think you want
C = X\Y
if you just need estimates, no other statistical information. If not, please explain specifically what else you need.
The mvregress function is another possibility.

tang
tang 2012년 4월 4일
Hi Richard, do you have try the command regress? If the quality of data is good,the outcome may be ok

Richard
Richard 2012년 4월 4일
Actually C = X\Y works, I've tried this before. But I'd like to have additional statistical information, e.g. t-values, R^2 or residual diagnostic plots.
I think regress doesn't work, as it accepts a n-by-1 vector of observed values and i've got a n-by-6.
How could I use mvregress do deal with an n-by-6 observed value matrix to get a 6-by-6 estimator matrix?

Community Treasure Hunt

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

Start Hunting!

Translated by