After almost 1 year of development the GRASS Development team has released the new stable release GRASS GIS 7.6.0. A big thanks to all developers for their work and dedication!
There is a lot to like, including further improvements to the user experience and new useful additional functionalities to modules. I, for example am curious to try out the new raster map type, the GRASS virtual raster (VRT). This is a virtual mosaic of a list of input raster maps.
But I would say, head over to the overview page where you can read more about the new features in the 7.6 release series: new features in GRASS GIS 7.6. Or update GRASS and check out yourself.
For those who missed it, a new update release GRASS GIS 7.4.4 is available since the 4th of January. It mainly brings bugfixes, but it also includes an important new function, the module r.mapcalc.simple. This module is especially important for a better integration with QGIS. It therefore has already been dubbed the “QGIS friendship” release :).
I am currently working on some exercises for which I need data about municipalities in the Netherlands. A good place to look for such data is the CBS (Dutch Central Bureau of Statistics). One data layer is vector layers of the dutch municipalities and neighborhoods, which include demographic data.
One of the first things I normally do when exploring new data is to look at the distribution of the data. For example by creating a histogram using the d.vect.colhist addon (see my earlier post). But what if I want to compare the distribution of different groups or samples? In such a case I find boxplots more convenient. However, there is no tool in GRASS GIS to create boxplots, so I had a look at the d.vect.colhist addon code and adapted the code to create boxplots instead of histograms.
Let’s for example look at the average population densities of the municipalities.
What if I want to compare the distribution of the average population density per provinces Dutch provinces? You can install the addon (see the end of this post) and run d.vect.colbp on the command line or the console. This will open a window with different tabs.
In the first tab, you can define a column in the attribute table to plot (here BEV_DICHTH, which is the column with the population density) and a column that will be used to group the data (here provincie, which gives the names of the provinces the municipality belongs to). As you can see in the screenshot above, you have a few options to change the plot (layout). In this case, I choose to rotate the x-axis labels so they do not overlap. The resulting plot looks like:
You can of course also use the command line. In this case I will plot the boxplots horizontally using the ‘h flag’.
The add-on does not provide further options to change the appearance of the plot, as the main idea is to use this for quick exploration of your data, similar to the other plotting tools in GRASS GIS. However, you can save the plot as a svg file, and further edit it in e.g., Inkscape.
Testing the add-on
I probably will try to integrate the option to create boxplots in the existing d.vect.colhist add-on, but for now it is available as a separate addon on Github for testing. For GRASS GIS version 7.2 and above, you can use g.extension; simply type on the command line:
I am sure there is a lot to improve as this was a rather quick hack, so any feedback will be most welcome. If you try it out and run into problems, please let me know (suggestions for improvements are of course also welcome).
GRASS GIS has convenient tools to draw histograms of raster values. As similar tool to draw a histogram of values in a vector attribute table lacks. But you can easily add this functionality by installing the d.vect.colhist addon by Moritz Lennert. Read this short post on Ecodiv.earth tutorials.
A common technique to estimate the accuracy of a predictive model is k-fold cross-validation. In k-fold cross-validation, the original sample is randomly partitioned into a number of sub-samples with an approximately equal number of records. Of these sub-samples, a single sub-sample is retained as the validation data for testing the model, and the remaining sub-samples are combined to be used as training data. The cross-validation process is then repeated as many times as there are sub-samples, with each of the sub-samples used exactly once as the validation data (Table 1).
The k evaluation results can then be averaged (or otherwise combined) to produce a single estimation. The advantage of this method is that all observations are used for both training and validation, and each observation is used for validation exactly once.
Functions for modelling and machine learning in e.g., R and Python’s Scikit-learn often contain build-in cross-validation routines. But it is also fairly easy to build such a routine yourself. This tutorial shows how one can easily build a k-fold cross-validation routine in GRASS GIS, e.g., to evaluate the predictive performance of two interpolation techniques, the inverse Distance Weighting and bilinear spline interpolation.