C ++中的多元线性回归 [英] Multivariate Linear Regression in c++

查看:160
本文介绍了C ++中的多元线性回归的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个向量A [a1,a2,a3]和B [b1,b2,b3].我想找到一个相关"矩阵X(3x3),该矩阵可以根据A'的新传入数据进行预测以产生B'的输出预测.基本上到最后:A'* X得到B'.

我有很多A和B(成对)的记录数据.根据下面的答案(我同意),我认为这是多元线性回归.我认为应该有通用的库来执行此操作,但是我对多元线性回归的理解还不足以实现它们.我也不知道要使用哪种算法和库.

鉴于此,

  b1 = x1_1 * a1 + x2_1 * a2 + x3_1 * a3 + e1b2 = x1_2 * a1 + x2_2 * a2 + x3_2 * a3 + e2b3 = x3_1 * a1 + x3_2 * a2 + x3_3 * a3 + e3 

对每个变量进行多元线性回归并将其组合在一起是否有意义?如果没有,为什么不呢?

解决方案

这不是多元回归,而是多元回归.基本上可以看成是要估计三个多元回归模型

  b1 = t1_1 * a1 + t2_1 * a2 + t3_1 * a3 + e1b2 = t1_2 * a1 + t2_2 * a2 + t3_2 * a3 + e2b3 = t3_1 * a1 + t3_2 * a2 + t3_3 * a3 + e3 

但是他想同时进行b的统计显着性检验时要考虑b1,b2,b3中的相关性.因为如果分别估计每个模型和估计多元模型,模型系数的矩阵将是相同的,因此您可以分别估计每个模型(对于每个b)并将结果合并到矩阵A中.您将不会仅获得多元检验.它们很有用,但是如果您仅对定量关系感兴趣,可以跳过它们.或者,您也可以自己编写它们,请参阅MANOVA的 F检验.

多元回归

您可以在 dlib gsl .

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?

解决方案

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.

这篇关于C ++中的多元线性回归的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆