Created
April 29, 2015 14:32
-
-
Save albertmeronyo/3cb0dac842255ad966af to your computer and use it in GitHub Desktop.
Standard deviation in (pure) SPARQL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT ((SUM((?n - ?mean)*(?n - ?mean)))/(COUNT(?n) - 1) AS ?sdev) WHERE { | |
?obs qb:value ?n . | |
{ | |
SELECT (AVG(?n) AS ?mean) WHERE { | |
?obs qb:value ?n . | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This actually calculates variance, (including Bessel's correction). To go from this to a standard deviation requires a square root operation, which isn't available in pure SPARQL.