- A – the predictor matrix [x w z … ]
- b – the response vector y
- W – a block‑diagonal weight or full covariance matrix built from your per‑point uncertainties
How to do multiple regression where all dependent and independent variables have uncertainties?
조회 수: 4 (최근 30일)
이전 댓글 표시
I have some data that I would like to run multiple regression on. The important thing here is that I would like the multiple regression to take into account the uncertainties in each of the data points -- something that mvregress doesn't do, as far as I can tell. What's more, each measurement in each of the variables has an uncertainty associated with it. For example, each measurement y(i) in the dependent variable y has its own uncertainty sy(i).
y = [y(1) y(2) ... y(n)]; % measured values of y
sy = [sy(1) sy(2) ... sy(n)] % uncertainties in measured values of y
The same goes for each of the independent variables x, w, z, etc.
x = [x(1) x(2) ... x(n)]
sx = [sx(1) sx(2) ... sx(n)]
When doing a single linear regression analysis, the function york_fit is able to handle data that have uncertainties in both the measured x- and y-values. I'd like to use something analogous to that -- just for multiple regression.
Anybody know how to do that? Is there a variant on mvregress that does that? Are there any canned functions that do that?
-Ken
댓글 수: 0
답변 (1개)
TED MOSBY
2025년 5월 7일
Hi,
A convenient implementation for this case can be the File‑Exchange package “Total Least Squares with mixed and/or weighted disturbances” (gtls.m / gmtls.m)
Have a look at the examples in the link above.
It lets you give:
A basic implementation can be as below:
n = numel(y);
A = [x(:) w(:) z(:) ones(n,1)];
b = y(:);
Sig = diag([sx(:); sw(:); sz(:); sy(:)].^2);
beta = gtls(A,b,Sig);
Modify this according to your use-case.
Hope this helps!
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Linear Regression에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!