I am trying to get Linear Regression
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main()
{
double x[7] = { 1.5, 2.4, 3.2, 4.8, 5.0, 7.0, 8.43 };
double y[7] = { 3.5, 5.3, 7.7, 6.2, 11.0, 9.5, 10.27 };
Maths::Regression::Linear A(7, x, y);
cout << " Slope = " << A.getSlope() << endl;
cout << "Intercept = " << A.getIntercept() << endl << endl;
cout << "Regression coefficient = " << A.getCoefficient() << endl;
cout << endl << "Regression line values" << endl << endl;
for (double i = 0.0; i <= 3; i += 0.6)
{
cout << "x = " << setw(3) << i << " y = " << A.getValue(i);
cout << endl;
}
return 0;
}
Why do you think there is something wrong with it? Do you get errors or something?