4
$\begingroup$

I am trying to discern the best way to calculate a correlation and perform a one-way ANOVA on data I am taking from a PostgreSQL database.

  • What tools should I use?
  • Can I do this using the SQL language itself?
  • Is there an easy way to export the data?
$\endgroup$
3
$\begingroup$

Although you can substitute the values into the ANOVA formulas and correlation formulas yourself, maybe even calculate everything using SQL you probably want to use the ANOVA and correlation features of a statistical software. All major statistical software (SAS, SPSS, Stata, R, Statistica etc) are able to connect to databases and get the data table with a simple SQL query. Besides direct connections you can use files as well to transfer the data: export the data into a file and import them into the statistical software. The comma separated values format is often used, but many other formats may work well.

$\endgroup$
2
$\begingroup$

For simple correlation, in would use the statistical functions which are directly available in Postgre.

e.g. ----> SELECT CORR(x, y) FROM YourTable;

For ANOVA it is a bit tougher. You might be better off transforming your problem to one involving regression and use the regression formulas.

http://www.postgresql.org/docs/8.2/static/functions-aggregate.html

$\endgroup$
  • $\begingroup$ can that do ANOVA? $\endgroup$ – Spencer Apr 27 '11 at 16:04
  • $\begingroup$ As suggested by GaBorgulya, you are better off using a stat package. Unless PostGre is able to do multiple regression (which looks like it does not), you are limited to testing the difference between 2 groups since your two groups could be dummy coded into 1 variable. psych.unl.edu/psycrs/statpage/coding_eg.pdf $\endgroup$ – Ralph Winters Apr 27 '11 at 16:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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