Extract p-value from anova of composion of two linear model functions in C++ Eigen

I am the beginner of C++, any help will be appreciated.

suppose that model 1: A1*X1=Y,model 2: A2*X2=Y
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <Eigen/Dense>
#include <iostream>
#include <string>
using namespace std;
using namespace Eigen;

main(){
    MatrixXd Y(10,1);
    MatrixXd X1(10,2);
    MatrixXd X2(10,1);

    Y<<50,51,52,54,53,60,59,65,67,70;
    X1<<29,54
          ,39,61
          ,26,52
          ,48,70
          ,42,63
          ,64,79
          ,45,68
          ,30,65
          ,51,79
         ,44,76;
    X2<<29,39,26,48,42,64,45,30,51,44;
        ...
}
//############################
//Analysis of Variance Table
//Model 1: Y ~ Xf
//Model 2: Y ~ Xr
//  Res.Df    RSS Df Sum of Sq      F    Pr(>F)    
//1      7  29.30                                  
//2      8 409.88 -1   -380.57 90.912 2.926e-05 *** 


I want to get Pr(>F) value:2.926e-05, how could I do in C++ Eigen?
Last edited on
Topic archived. No new replies allowed.