Qgis Basic Stats Plugin

By connecting Qgis to R using Python we can add basic stats functionality to Qgis.

Don't believe me? Check out the screenshots:

Note that Qgis now has a 'Statistics' menu at the top. That drops down to show things like 'Summary', 'Histogram', 'XY-plot', and 'Linear Model'. Here you see a histogram dialog in the first screenshot - the user chooses a layer and attribute and then R draws a histogram. In this case a histogram of the areas of African countries. The second example is fitting a linear regression model to two variables. On the right is the Spqr dialog, on the left is the standard four diagnostic plots from R, and below that is the text summary of the model from R giving significances and R-squareds. The third example shows a barplot giving the area in square miles and square kilometres for a selection of countries. The labels are in 2-digit abbreviation codes.

Download

For experts and crazy people only. Bits of this aren't implemented and other bits don't work and most of it will break if you push it.

Install

Prerequisites:

Extract the tarball into your QGis python plugin directory. Run QGis and activate it from the plugin config dialog. You should get a 'Statistics' menu.

Usage

Load some vector maps into QGis. Use the Statistics menu and choose a layer and attributes to work on. Results are either popped up as graphs in an R graphics window or come up in text boxes (or both - the linear modelling shows some diagnostic plots and gives you a text summary).

If you select a subset of your layer with the standard QGis select tools, the statistics operate on that subset. Otherwise they take the whole layer data.

Bugs and problems and TODOs

License

This code is copyright © Barry Rowlingson - you may download and use this for its intended purpose which is mucking about with statistics in QGis. Eventually I'll release this under something like the GPL once I sort out putting the code into SVN and all that.