4

I am creating a field for a z-score of a particular attribute. This requires calculating the mean and the standard deviation for the attribute across all features. I've been using the statistics window to get the mean and standard deviation, copying them into a field, and then doing the calculations in a third field, but I feel like that's not very efficient. I can't find a way to calculate the mean using the field calculator and my scripting skills are pretty weak.

4

In the Field Calculator, you can use the following Aggregate functions:

  • Mean

    mean( "fieldName" )
    
  • Standard deviation

    stdev( "fieldName" )
    

Tested on QGIS 2.18

  • 1
    Hey, that's good to know about! Thanks for the updated answer on this. – Brian Jul 7 '17 at 20:19
-1

Zonal statistics plugin could be used.

https://docs.qgis.org/2.18/en/docs/user_manual/plugins/plugins_zonal_statistics.html

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

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.