4

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?
Jeromy Anglim
  • 42,044
  • 23
  • 146
  • 250
Spencer
  • 221
  • 3
  • 11

2 Answers2

3

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.

GaBorgulya
  • 3,253
  • 15
  • 19
2

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

Ralph Winters
  • 801
  • 5
  • 7
  • can that do ANOVA? – Spencer Apr 27 '11 at 16:04
  • 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. http://psych.unl.edu/psycrs/statpage/coding_eg.pdf – Ralph Winters Apr 27 '11 at 16:43