Multivariate Linear Regression in c++ [closed]

谁说胖子不能爱 提交于 2020-06-27 04:49:14

问题


I have a vector A[a1, a2, a3] and B[b1, b2, b3]. I want to find a "correlation" matrix X (3x3) that can predict from new incoming data of A' to to produce output predictions of B'. Basically in the end: A'*X to get B'.

I have lots of recorded data of A and B (paired). Based on an answer below (and I agree), I think this is Multivariate Linear Regression. I think there should be common libraries doing this, but I don't understand enough of multivariate linear regression to implement them. Nor do I know which algorithm and library to use.

Given that,

b1 = x1_1*a1 + x2_1*a2 + x3_1*a3 + e1
b2 = x1_2*a1 + x2_2*a2 + x3_2*a3 + e2
b3 = x3_1*a1 + x3_2*a2 + x3_3*a3 + e3

Would it make sense to do multiple linear regression on each, and combine the solution together? If not, why not?


回答1:


This is not a multiple regression, but a multivariate regression. Basically this can be viewed as if one was to estimate three multiple regression models

b1 = t1_1* a1 + t2_1 * a2 + t3_1 * a3 + e1
b2 = t1_2* a1 + t2_2 * a2 + t3_2 * a3 + e2
b3 = t3_1* a1 + t3_2 * a2 + t3_3 * a3 + e3

but he wants to take into account correlations in b1, b2, b3 when doing simultaneous tests for b's statistical significance. Because the matrix of model coefficients will be same if you estimated each model separately as if you estimated multivariate model, you can just estimate each model ( for each b) separately and combine results into matrix A. You won't just get multivariate tests. They are helpful but if you are interested simply in quantitative relationship you can skip them. Or you can write them by yourself, look at F-test, MANOVA.

Multivariate regression

You can find help in dlib, dlib, gsl.



来源:https://stackoverflow.com/questions/23860821/multivariate-linear-regression-in-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!