I'm using the GSL statistical package to perform a linear regression on two sets of numbers. I don't have a heavy statistical background, and I'm used to seeing regressions presented in visual format, so I'm having trouble interpreting the results:

Results of Linear Regression:

c0 0.009
c1 0.521
cov00 0.000
cov01 -0.000
cov11 0.010
chisq 0.684
Pearson Correlation: 0.499

The documentation says:

GSL::Fit::linear(x, y)

"This function computes the best-fit linear regression coefficients (c0,c1) of the model Y = c0 + c1 X for the datasets (x, y), two vectors of equal length with stride 1. This returns an array of 7 elements, [c0, c1, cov00, cov01, cov11, chisq, status], where c0, c1 are the estimated parameters, cov00, cov01, cov11 are the variance-covariance matrix elements, chisq is the sum of squares of the residuals, and status is the return code from the GSL function gsl_fit_linear()." http://codeforpeople.com/lib/ruby/rb-gsl-win/rb-gsl-1.7.0/html/fit.html

Assuming I want to determine how closely predicted values match actual values, how do I interpret this?

Also, I assume I should normalize both vectors to scale 0, 1 before feeding it to the regression function?

  • $\begingroup$ What do your outcome y and explanatory variable x look like? $\endgroup$
    – dimitriy
    Jan 30, 2013 at 23:30
  • $\begingroup$ I put them here gist.github.com/4680507 Dimitriy $\endgroup$ Jan 31, 2013 at 5:30

1 Answer 1


Let me translate this output into a more visual format. You've basically fit an equation that is $y = .0094922 + .5210616 \cdot x$ to the data (straight blue line and green points below). That's your prediction of $y$ for each value of $x$.

This model has an unadjusted $R^2$ of $0.2494$, which is reasonable for cross-sectional data like this. I am not sure what the covariance terms above are. They do not seem to correspond to anything I get with my software, so watch out for that.

You can interpret the correlation as a measure of fit with this simple model. The correlation between your prediction and your actual data is about $0.4994$.

I don't think it helps to normalize this data (subtract the mean and divide by the standard deviation), unless it help with the interpretation somehow. It won't help the fit. I am also not sure if you had another transformation in mind above.

There does seems to be a strange nonlinear relationship, which is picked up by the lowess (a fancier type of regression, orange line). Since you have not told us anything about the data, it's hard to know whether this is something that is meaningful.

enter image description here

  • $\begingroup$ Thanks Dimitriy. The data is from an incredibly dumb sentiment analysis tool. I basically took 50 user comments, subjectively rated them on positive or negative sentiment, then ran them through the sentiment analyzer. $\endgroup$ Jan 31, 2013 at 7:07
  • $\begingroup$ The rationale was to change the sentiment analyzer, and measure the fit to see if it was closer to the expected values. $\endgroup$ Jan 31, 2013 at 7:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.