From 341446849692157ab8f4672bd2d7b9834dd07f2a Mon Sep 17 00:00:00 2001 From: arelaestudio Date: Sun, 16 Mar 2025 16:33:46 +0000 Subject: [PATCH 1/2] Automated Extension submission for issue #1601 --- extensions/community/Statistics.json | 1428 ++++++++++++++++++++++++++ 1 file changed, 1428 insertions(+) create mode 100644 extensions/community/Statistics.json diff --git a/extensions/community/Statistics.json b/extensions/community/Statistics.json new file mode 100644 index 000000000..346112735 --- /dev/null +++ b/extensions/community/Statistics.json @@ -0,0 +1,1428 @@ +{ + "author": "", + "category": "General", + "extensionNamespace": "", + "fullName": "Statistics", + "gdevelopVersion": "", + "helpPath": "", + "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLWNoYXJ0LWJlbGwtY3VydmUiIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNOS45NiwxMS4zMUMxMC44Miw4LjEgMTEuNSw2IDEzLDZDMTQuNSw2IDE1LjE4LDguMSAxNi4wNCwxMS4zMUMxNywxNC45MiAxOC4xLDE5IDIyLDE5VjE3QzE5LjgsMTcgMTksMTQuNTQgMTcuOTcsMTAuOEMxNy4wOCw3LjQ2IDE2LjE1LDQgMTMsNEM5Ljg1LDQgOC45Miw3LjQ2IDguMDMsMTAuOEM3LjAzLDE0LjU0IDYuMiwxNyA0LDE3VjJIMlYyMkgyMlYyMEg0VjE5QzcuOSwxOSA5LDE0LjkyIDkuOTYsMTEuMzFaIiAvPjwvc3ZnPg==", + "name": "Statistics", + "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/864a93d4274c7c7c62e95b113c4cfe061df2363cadc747ba02de8e43aed57fce_chart-bell-curve.svg", + "shortDescription": "Basic statistcs function.", + "version": "1.0.0", + "description": [ + "Its main function is the \"normal random number generator\" (NormalRNG). This function generates a random number that follows a normal (bell-shaped) distribution. Such distribution has a central tendency value (mean) and a margin of deviation (standard deviation). NormalRNG is bounded so that extreme values (abnormally high or small numbers, called outliers) do not occur.", + "", + "This extension also includes a library of common values to check for probability, be it the chance of being above a certain number (one-tailed, \"potxx\") or the chance of being inside a range (two-tailed, \"pttxx\") where xx is the chance of success." + ], + "tags": [ + "random", + "probability", + "statistics" + ], + "authorIds": [ + "JJYR7q4MEBS2ap7ziDiYGlY40Fi2" + ], + "dependencies": [], + "globalVariables": [], + "sceneVariables": [ + { + "name": "NRNG", + "type": "structure", + "children": [ + { + "name": "pCheck", + "type": "number", + "value": 0 + }, + { + "name": "pot01", + "type": "number", + "value": -2.326348 + }, + { + "name": "pot05", + "type": "number", + "value": -1.644854 + }, + { + "name": "pot10", + "type": "number", + "value": -1.281552 + }, + { + "name": "pot15", + "type": "number", + "value": -1.036433 + }, + { + "name": "pot20", + "type": "number", + "value": -0.841621 + }, + { + "name": "pot25", + "type": "number", + "value": -0.67449 + }, + { + "name": "pot33", + "type": "number", + "value": -0.430727 + }, + { + "name": "pot40", + "type": "number", + "value": -0.253347 + }, + { + "name": "pot50", + "type": "number", + "value": 0 + }, + { + "name": "ptt01", + "type": "number", + "value": 0.012533 + }, + { + "name": "ptt05", + "type": "number", + "value": 0.062707 + }, + { + "name": "ptt10", + "type": "number", + "value": 0.125661 + }, + { + "name": "ptt15", + "type": "number", + "value": 0.189118 + }, + { + "name": "ptt20", + "type": "number", + "value": 0.253347 + }, + { + "name": "ptt25", + "type": "number", + "value": 0.318639 + }, + { + "name": "ptt33", + "type": "number", + "value": 0.430727 + }, + { + "name": "ptt40", + "type": "number", + "value": 0.524401 + }, + { + "name": "ptt50", + "type": "number", + "value": 0.67449 + }, + { + "name": "ptt60", + "type": "number", + "value": 0.841621 + }, + { + "name": "ptt66", + "type": "number", + "value": 0.967422 + }, + { + "name": "ptt75", + "type": "number", + "value": 1.150349 + }, + { + "name": "ptt80", + "type": "number", + "value": 1.281552 + }, + { + "name": "ptt85", + "type": "number", + "value": 1.439531 + }, + { + "name": "ptt90", + "type": "number", + "value": 1.644854 + }, + { + "name": "ptt95", + "type": "number", + "value": 1.959964 + }, + { + "name": "ptt99", + "type": "number", + "value": 2.575829 + }, + { + "name": "pttxx", + "type": "number", + "value": 0 + }, + { + "name": "random", + "type": "number", + "value": 0 + }, + { + "name": "zscore", + "type": "number", + "value": 0 + } + ] + } + ], + "eventsFunctions": [ + { + "description": "Generates a random number that follows a normal distribution.", + "fullName": "Normalized random", + "functionType": "Expression", + "name": "NormalRNG", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.random", + "=", + "(RandomFloat(1)+RandomFloat(1)+RandomFloat(1)+RandomFloat(1)+RandomFloat(1)+RandomFloat(1)+RandomFloat(1)+RandomFloat(1)+RandomFloat(1)+RandomFloat(1))" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.random", + "=", + "(NRNG.random - 5) / 0.913992" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.random", + "=", + "Mean + (StdDev * NRNG.random)" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Bounds", + "=", + "\"90%\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.pttxx", + "=", + "NRNG.ptt90" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Bounds", + "=", + "\"95%\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.pttxx", + "=", + "NRNG.ptt95" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Bounds", + "=", + "\"99%\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.pttxx", + "=", + "NRNG.ptt99" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Bounds", + "=", + "\"100%\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.pttxx", + "=", + "3" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "NRNG.random", + "<", + "Mean - NRNG.pttxx * StdDev" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.random", + "=", + "Mean - NRNG.pttxx * StdDev" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "NRNG.random", + ">", + "Mean + NRNG.pttxx * StdDev" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.random", + "=", + "Mean + NRNG.pttxx * StdDev" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "NRNG.random" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Mean", + "name": "Mean", + "type": "expression" + }, + { + "description": "Standard deviation (1 sigma)", + "name": "StdDev", + "type": "expression" + }, + { + "description": "Upper bound of the max allowed deviation", + "name": "Bounds", + "supplementaryInformation": "[\"90%\",\"95%\",\"99%\",\"100%\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": " the probability of the number against a normal distribution.", + "fullName": "Probability check", + "functionType": "ExpressionAndCondition", + "name": "ProbabilityCheck", + "sentence": "The _PARAM4_ probability of _PARAM1_ against a normal distribution (Mean:_PARAM2_; StdDev:_PARAM3_)", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.zscore", + "=", + "(NumberToCheck-Mean)/StdDev" + ] + } + ] + }, + { + "folded": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Type", + "=", + "\"OneTail\"" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "NRNG.zscore", + "<", + "NRNG.pot01" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.pCheck", + "=", + "0" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "NRNG.zscore", + ">", + "NRNG.pot01" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.pCheck", + "=", + "1" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "NRNG.zscore", + ">", + "NRNG.pot05" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.pCheck", + "=", + "5" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "NRNG.zscore", + ">", + "NRNG.pot10" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.pCheck", + "=", + "10" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "NRNG.zscore", + ">", + "NRNG.pot20" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.pCheck", + "=", + "20" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "NRNG.zscore", + ">", + "NRNG.pot25" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.pCheck", + "=", + "25" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "NRNG.zscore", + ">", + "NRNG.pot33" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.pCheck", + "=", + "33" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "NRNG.zscore", + ">", + "NRNG.pot40" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.pCheck", + "=", + "40" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "NRNG.zscore", + ">", + "NRNG.pot50" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.pCheck", + "=", + "50" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "NRNG.zscore", + ">", + "-NRNG.pot40" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.pCheck", + "=", + "60" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "NRNG.zscore", + ">", + "-NRNG.pot33" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.pCheck", + "=", + "66" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "NRNG.zscore", + ">", + "-NRNG.pot25" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.pCheck", + "=", + "75" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "NRNG.zscore", + ">", + "-NRNG.pot20" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.pCheck", + "=", + "80" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "NRNG.zscore", + ">", + "-NRNG.pot10" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.pCheck", + "=", + "90" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "NRNG.zscore", + ">", + "-NRNG.pot05" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.pCheck", + "=", + "95" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "NRNG.zscore", + ">", + "-NRNG.pot01" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.pCheck", + "=", + "99" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "NRNG.zscore", + ">", + "3" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.pCheck", + "=", + "100" + ] + } + ] + } + ] + }, + { + "folded": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Type", + "=", + "\"TwoTails\"" + ] + } + ], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::CompareNumbers" + }, + "parameters": [ + "abs(NRNG.zscore)", + "<", + "NRNG.ptt01" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.pCheck", + "=", + "50.0" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::CompareNumbers" + }, + "parameters": [ + "abs(NRNG.zscore)", + ">", + "NRNG.ptt01" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.pCheck", + "=", + "50.5" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::CompareNumbers" + }, + "parameters": [ + "abs(NRNG.zscore)", + ">", + "NRNG.ptt05" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.pCheck", + "=", + "52.5" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::CompareNumbers" + }, + "parameters": [ + "abs(NRNG.zscore)", + ">", + "NRNG.ptt10" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.pCheck", + "=", + "55.0" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::CompareNumbers" + }, + "parameters": [ + "abs(NRNG.zscore)", + ">", + "NRNG.ptt20" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.pCheck", + "=", + "60.0" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::CompareNumbers" + }, + "parameters": [ + "abs(NRNG.zscore)", + ">", + "NRNG.ptt25" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.pCheck", + "=", + "62.5" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::CompareNumbers" + }, + "parameters": [ + "abs(NRNG.zscore)", + ">", + "NRNG.ptt33" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.pCheck", + "=", + "66.7" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::CompareNumbers" + }, + "parameters": [ + "abs(NRNG.zscore)", + ">", + "NRNG.ptt50" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.pCheck", + "=", + "75.0" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::CompareNumbers" + }, + "parameters": [ + "abs(NRNG.zscore)", + ">", + "NRNG.ptt60" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.pCheck", + "=", + "80.0" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::CompareNumbers" + }, + "parameters": [ + "abs(NRNG.zscore)", + ">", + "NRNG.ptt66" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.pCheck", + "=", + "83.3" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::CompareNumbers" + }, + "parameters": [ + "abs(NRNG.zscore)", + ">", + "NRNG.ptt75" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.pCheck", + "=", + "87.5" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::CompareNumbers" + }, + "parameters": [ + "abs(NRNG.zscore)", + ">", + "NRNG.ptt80" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.pCheck", + "=", + "90.0" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::CompareNumbers" + }, + "parameters": [ + "abs(NRNG.zscore)", + ">", + "NRNG.ptt90" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.pCheck", + "=", + "95.0" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::CompareNumbers" + }, + "parameters": [ + "abs(NRNG.zscore)", + ">", + "NRNG.ptt95" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.pCheck", + "=", + "97.5" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::CompareNumbers" + }, + "parameters": [ + "abs(NRNG.zscore)", + ">", + "NRNG.ptt99" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.pCheck", + "=", + "99.5" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::CompareNumbers" + }, + "parameters": [ + "abs(NRNG.zscore)", + ">", + "3" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "NRNG.pCheck", + "=", + "100" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "NRNG.pCheck" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Number to be checked", + "name": "NumberToCheck", + "type": "expression" + }, + { + "description": "Mean", + "name": "Mean", + "type": "expression" + }, + { + "description": "Standard deviation (1 sigma)", + "name": "StdDev", + "type": "expression" + }, + { + "description": "Type of check", + "name": "Type", + "supplementaryInformation": "[\"OneTail\",\"TwoTails\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + } + ], + "eventsBasedBehaviors": [], + "eventsBasedObjects": [] +} \ No newline at end of file From 8f2af07af79d5aac157616dc8f9f5ccb02869c58 Mon Sep 17 00:00:00 2001 From: arelaestudio Date: Sat, 5 Apr 2025 02:53:21 +0000 Subject: [PATCH 2/2] Updated extension --- extensions/community/Statistics.json | 1059 ++++++++++++++------------ 1 file changed, 575 insertions(+), 484 deletions(-) diff --git a/extensions/community/Statistics.json b/extensions/community/Statistics.json index 346112735..b3bc7c39e 100644 --- a/extensions/community/Statistics.json +++ b/extensions/community/Statistics.json @@ -2,18 +2,32 @@ "author": "", "category": "General", "extensionNamespace": "", - "fullName": "Statistics", + "fullName": "Normal Distribution Statistics", "gdevelopVersion": "", - "helpPath": "", + "helpPath": "https://wiki.gdevelop.io/gdevelop5/tutorials/randomness/#chose-better-random-sequences", "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLWNoYXJ0LWJlbGwtY3VydmUiIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNOS45NiwxMS4zMUMxMC44Miw4LjEgMTEuNSw2IDEzLDZDMTQuNSw2IDE1LjE4LDguMSAxNi4wNCwxMS4zMUMxNywxNC45MiAxOC4xLDE5IDIyLDE5VjE3QzE5LjgsMTcgMTksMTQuNTQgMTcuOTcsMTAuOEMxNy4wOCw3LjQ2IDE2LjE1LDQgMTMsNEM5Ljg1LDQgOC45Miw3LjQ2IDguMDMsMTAuOEM3LjAzLDE0LjU0IDYuMiwxNyA0LDE3VjJIMlYyMkgyMlYyMEg0VjE5QzcuOSwxOSA5LDE0LjkyIDkuOTYsMTEuMzFaIiAvPjwvc3ZnPg==", "name": "Statistics", "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/864a93d4274c7c7c62e95b113c4cfe061df2363cadc747ba02de8e43aed57fce_chart-bell-curve.svg", - "shortDescription": "Basic statistcs function.", - "version": "1.0.0", + "shortDescription": "Basic statistcs functions for normal distributions.", + "version": "1.1.0", "description": [ - "Its main function is the \"normal random number generator\" (NormalRNG). This function generates a random number that follows a normal (bell-shaped) distribution. Such distribution has a central tendency value (mean) and a margin of deviation (standard deviation). NormalRNG is bounded so that extreme values (abnormally high or small numbers, called outliers) do not occur.", + "Its main function is the \"normal random number generator\" (NormalRNG). This function generates a random number that follows a normal (bell-shaped) distribution. Such distribution has a central tendency value (mean) and a margin of deviation (standard deviation, or StdDev). NormalRNG is bounded so that extreme values (abnormally high or small numbers, called outliers) do not occur.", "", - "This extension also includes a library of common values to check for probability, be it the chance of being above a certain number (one-tailed, \"potxx\") or the chance of being inside a range (two-tailed, \"pttxx\") where xx is the chance of success." + "This extension also includes a library of common values to check for probability, be it the chance of being above a certain number (\"One-Tail\"), the chance of being different to a population (\"Two-tails\"), or the chance of being in a range. Probabilities are given in percentage and coded as pXXX. For example, p950 gives the 95.0% probability.", + "", + "As support, the extension also can generate Z-values (distance between the mean and the number, measured in StdDev), calculate and compare them with others (as Z-Scores).", + "", + "This covers the basics on normal distributions. For an implementation example take a look here:", + "https://gd.games/arelaestudio/statistics-example", + "", + "Principles of randomness can be found in:", + "https://wiki.gdevelop.io/gdevelop5/tutorials/randomness/#chose-better-random-sequences", + "", + "Foundations on the extension can be found here:", + "https://en.wikipedia.org/wiki/Normal_distribution#Computational_methods", + "https://en.wikipedia.org/wiki/Irwin%E2%80%93Hall_distribution", + "https://en.wikipedia.org/wiki/One-_and_two-tailed_tests", + "https://en.wikipedia.org/wiki/Standard_score" ], "tags": [ "random", @@ -27,368 +41,158 @@ "globalVariables": [], "sceneVariables": [ { - "name": "NRNG", + "name": "pCheck", + "type": "number", + "value": 0 + }, + { + "folded": true, + "name": "OneTail", "type": "structure", "children": [ { - "name": "pCheck", + "name": "p010", "type": "number", - "value": 0 + "value": -2.32634787404 }, { - "name": "pot01", + "name": "p025", "type": "number", - "value": -2.326348 + "value": -1.95996398454 }, { - "name": "pot05", + "name": "p050", "type": "number", - "value": -1.644854 + "value": -1.64485362695 }, { - "name": "pot10", + "name": "p083", "type": "number", - "value": -1.281552 + "value": -1.38299434452 }, { - "name": "pot15", + "name": "p100", "type": "number", - "value": -1.036433 + "value": -1.28155156554 }, { - "name": "pot20", + "name": "p125", "type": "number", - "value": -0.841621 + "value": -1.15034938038 }, { - "name": "pot25", + "name": "p150", "type": "number", - "value": -0.67449 + "value": -1.03643338949 }, { - "name": "pot33", + "name": "p167", "type": "number", - "value": -0.430727 + "value": -0.96742159278 }, { - "name": "pot40", + "name": "p200", "type": "number", - "value": -0.253347 + "value": -0.84162123357 }, { - "name": "pot50", + "name": "p250", "type": "number", - "value": 0 + "value": -0.6744897502 }, { - "name": "ptt01", + "name": "p300", "type": "number", - "value": 0.012533 + "value": -0.52440051271 }, { - "name": "ptt05", + "name": "p333", "type": "number", - "value": 0.062707 + "value": -0.43072730021 }, { - "name": "ptt10", + "name": "p350", "type": "number", - "value": 0.125661 + "value": -0.38532046641 }, { - "name": "ptt15", + "name": "p375", "type": "number", - "value": 0.189118 + "value": -0.31863936396 }, { - "name": "ptt20", + "name": "p400", "type": "number", - "value": 0.253347 + "value": -0.25334710314 }, { - "name": "ptt25", + "name": "p417", "type": "number", - "value": 0.318639 + "value": -0.21042841133 }, { - "name": "ptt33", + "name": "p450", "type": "number", - "value": 0.430727 - }, - { - "name": "ptt40", - "type": "number", - "value": 0.524401 - }, - { - "name": "ptt50", - "type": "number", - "value": 0.67449 - }, - { - "name": "ptt60", - "type": "number", - "value": 0.841621 - }, - { - "name": "ptt66", - "type": "number", - "value": 0.967422 - }, - { - "name": "ptt75", - "type": "number", - "value": 1.150349 - }, - { - "name": "ptt80", - "type": "number", - "value": 1.281552 - }, + "value": -0.12566134686 + } + ] + }, + { + "folded": true, + "name": "TwoTails", + "type": "structure", + "children": [ { - "name": "ptt85", + "name": "p683", "type": "number", - "value": 1.439531 + "value": 1 }, { - "name": "ptt90", + "name": "p750", "type": "number", - "value": 1.644854 + "value": 1.15034938038 }, { - "name": "ptt95", + "name": "p900", "type": "number", - "value": 1.959964 + "value": 1.64485362695 }, { - "name": "ptt99", + "name": "p950", "type": "number", - "value": 2.575829 + "value": 1.95996398454 }, { - "name": "pttxx", + "name": "p990", "type": "number", - "value": 0 + "value": 2.57582930355 }, { - "name": "random", + "name": "p997", "type": "number", - "value": 0 + "value": 3 }, { - "name": "zscore", + "name": "p999", "type": "number", - "value": 0 + "value": 6 } ] + }, + { + "name": "ZScore", + "type": "number", + "value": 0 } ], "eventsFunctions": [ { - "description": "Generates a random number that follows a normal distribution.", - "fullName": "Normalized random", + "description": "Generates a random number that follows a normal distribution. Bound to avoid extreme values.", + "fullName": "Normalized random number", "functionType": "Expression", "name": "NormalRNG", "sentence": "", "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "NRNG.random", - "=", - "(RandomFloat(1)+RandomFloat(1)+RandomFloat(1)+RandomFloat(1)+RandomFloat(1)+RandomFloat(1)+RandomFloat(1)+RandomFloat(1)+RandomFloat(1)+RandomFloat(1))" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "NRNG.random", - "=", - "(NRNG.random - 5) / 0.913992" - ] - }, - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "NRNG.random", - "=", - "Mean + (StdDev * NRNG.random)" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Bounds", - "=", - "\"90%\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "NRNG.pttxx", - "=", - "NRNG.ptt90" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Bounds", - "=", - "\"95%\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "NRNG.pttxx", - "=", - "NRNG.ptt95" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Bounds", - "=", - "\"99%\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "NRNG.pttxx", - "=", - "NRNG.ptt99" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Bounds", - "=", - "\"100%\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "NRNG.pttxx", - "=", - "3" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "NRNG.random", - "<", - "Mean - NRNG.pttxx * StdDev" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "NRNG.random", - "=", - "Mean - NRNG.pttxx * StdDev" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "NumberVariable" - }, - "parameters": [ - "NRNG.random", - ">", - "Mean + NRNG.pttxx * StdDev" - ] - } - ], - "actions": [ - { - "type": { - "value": "SetNumberVariable" - }, - "parameters": [ - "NRNG.random", - "=", - "Mean + NRNG.pttxx * StdDev" - ] - } - ] - }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [], @@ -398,7 +202,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "NRNG.random" + "clamp(Mean+(StdDev*Statistics::Zvalue()), Mean-(StdDev*TwoTails[Bounds]), Mean+(StdDev*TwoTails[Bounds]))" ] } ] @@ -419,9 +223,9 @@ "type": "expression" }, { - "description": "Upper bound of the max allowed deviation", + "description": "Bounds (p997 recommended)", "name": "Bounds", - "supplementaryInformation": "[\"90%\",\"95%\",\"99%\",\"100%\"]", + "supplementaryInformation": "[\"p683\",\"p750\",\"p900\",\"p950\",\"p990\",\"p997\",\"p999\"]", "type": "stringWithSelector" } ], @@ -429,10 +233,10 @@ }, { "description": " the probability of the number against a normal distribution.", - "fullName": "Probability check", + "fullName": "One-Tail test", "functionType": "ExpressionAndCondition", - "name": "ProbabilityCheck", - "sentence": "The _PARAM4_ probability of _PARAM1_ against a normal distribution (Mean:_PARAM2_; StdDev:_PARAM3_)", + "name": "OneTail", + "sentence": "_PARAM1_ chance of being _PARAM4_ against a normal distribution (Mean:_PARAM2_; StdDev:_PARAM3_)", "events": [ { "type": "BuiltinCommonInstructions::Standard", @@ -443,30 +247,121 @@ "value": "SetNumberVariable" }, "parameters": [ - "NRNG.zscore", + "ZScore", "=", - "(NumberToCheck-Mean)/StdDev" + "Statistics::ZScore(NumberToCheck,Mean,StdDev)" ] } - ] - }, - { - "folded": true, - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + ], + "events": [ { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Type", - "=", - "\"OneTail\"" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "ZScore", + "<", + "OneTail.p010" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "pCheck", + "=", + "0" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "ZScore", + ">", + "OneTail.p010" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "pCheck", + "=", + "1" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "ZScore", + ">", + "OneTail.p025" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "pCheck", + "=", + "2.5" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "ZScore", + ">", + "OneTail.p050" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "pCheck", + "=", + "5" + ] + } ] - } - ], - "actions": [], - "events": [ + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ @@ -475,9 +370,9 @@ "value": "NumberVariable" }, "parameters": [ - "NRNG.zscore", - "<", - "NRNG.pot01" + "ZScore", + ">", + "OneTail.p083" ] } ], @@ -487,9 +382,9 @@ "value": "SetNumberVariable" }, "parameters": [ - "NRNG.pCheck", + "pCheck", "=", - "0" + "8.33" ] } ] @@ -502,9 +397,9 @@ "value": "NumberVariable" }, "parameters": [ - "NRNG.zscore", + "ZScore", ">", - "NRNG.pot01" + "OneTail.p100" ] } ], @@ -514,9 +409,9 @@ "value": "SetNumberVariable" }, "parameters": [ - "NRNG.pCheck", + "pCheck", "=", - "1" + "10" ] } ] @@ -529,9 +424,9 @@ "value": "NumberVariable" }, "parameters": [ - "NRNG.zscore", + "ZScore", ">", - "NRNG.pot05" + "OneTail.p125" ] } ], @@ -541,9 +436,9 @@ "value": "SetNumberVariable" }, "parameters": [ - "NRNG.pCheck", + "pCheck", "=", - "5" + "12.5" ] } ] @@ -556,9 +451,9 @@ "value": "NumberVariable" }, "parameters": [ - "NRNG.zscore", + "ZScore", ">", - "NRNG.pot10" + "OneTail.p150" ] } ], @@ -568,9 +463,9 @@ "value": "SetNumberVariable" }, "parameters": [ - "NRNG.pCheck", + "pCheck", "=", - "10" + "15" ] } ] @@ -583,9 +478,9 @@ "value": "NumberVariable" }, "parameters": [ - "NRNG.zscore", + "ZScore", ">", - "NRNG.pot20" + "OneTail.p167" ] } ], @@ -595,9 +490,9 @@ "value": "SetNumberVariable" }, "parameters": [ - "NRNG.pCheck", + "pCheck", "=", - "20" + "16.67" ] } ] @@ -610,9 +505,9 @@ "value": "NumberVariable" }, "parameters": [ - "NRNG.zscore", + "ZScore", ">", - "NRNG.pot25" + "OneTail.p200" ] } ], @@ -622,9 +517,9 @@ "value": "SetNumberVariable" }, "parameters": [ - "NRNG.pCheck", + "pCheck", "=", - "25" + "20" ] } ] @@ -637,9 +532,9 @@ "value": "NumberVariable" }, "parameters": [ - "NRNG.zscore", + "ZScore", ">", - "NRNG.pot33" + "OneTail.p250" ] } ], @@ -649,9 +544,9 @@ "value": "SetNumberVariable" }, "parameters": [ - "NRNG.pCheck", + "pCheck", "=", - "33" + "25" ] } ] @@ -664,9 +559,9 @@ "value": "NumberVariable" }, "parameters": [ - "NRNG.zscore", + "ZScore", ">", - "NRNG.pot40" + "OneTail.p300" ] } ], @@ -676,9 +571,9 @@ "value": "SetNumberVariable" }, "parameters": [ - "NRNG.pCheck", + "pCheck", "=", - "40" + "30" ] } ] @@ -691,9 +586,9 @@ "value": "NumberVariable" }, "parameters": [ - "NRNG.zscore", + "ZScore", ">", - "NRNG.pot50" + "OneTail.p333" ] } ], @@ -703,9 +598,9 @@ "value": "SetNumberVariable" }, "parameters": [ - "NRNG.pCheck", + "pCheck", "=", - "50" + "33.33" ] } ] @@ -718,9 +613,9 @@ "value": "NumberVariable" }, "parameters": [ - "NRNG.zscore", + "ZScore", ">", - "-NRNG.pot40" + "OneTail.p350" ] } ], @@ -730,9 +625,9 @@ "value": "SetNumberVariable" }, "parameters": [ - "NRNG.pCheck", + "pCheck", "=", - "60" + "35" ] } ] @@ -745,9 +640,9 @@ "value": "NumberVariable" }, "parameters": [ - "NRNG.zscore", + "ZScore", ">", - "-NRNG.pot33" + "OneTail.p375" ] } ], @@ -757,9 +652,9 @@ "value": "SetNumberVariable" }, "parameters": [ - "NRNG.pCheck", + "pCheck", "=", - "66" + "37.5" ] } ] @@ -772,9 +667,9 @@ "value": "NumberVariable" }, "parameters": [ - "NRNG.zscore", + "ZScore", ">", - "-NRNG.pot25" + "OneTail.p400" ] } ], @@ -784,9 +679,9 @@ "value": "SetNumberVariable" }, "parameters": [ - "NRNG.pCheck", + "pCheck", "=", - "75" + "40" ] } ] @@ -799,9 +694,9 @@ "value": "NumberVariable" }, "parameters": [ - "NRNG.zscore", + "ZScore", ">", - "-NRNG.pot20" + "OneTail.p417" ] } ], @@ -811,9 +706,9 @@ "value": "SetNumberVariable" }, "parameters": [ - "NRNG.pCheck", + "pCheck", "=", - "80" + "41.67" ] } ] @@ -826,9 +721,9 @@ "value": "NumberVariable" }, "parameters": [ - "NRNG.zscore", + "ZScore", ">", - "-NRNG.pot10" + "OneTail.p450" ] } ], @@ -838,9 +733,9 @@ "value": "SetNumberVariable" }, "parameters": [ - "NRNG.pCheck", + "pCheck", "=", - "90" + "45" ] } ] @@ -853,9 +748,9 @@ "value": "NumberVariable" }, "parameters": [ - "NRNG.zscore", + "ZScore", ">", - "-NRNG.pot05" + "0" ] } ], @@ -865,9 +760,9 @@ "value": "SetNumberVariable" }, "parameters": [ - "NRNG.pCheck", + "pCheck", "=", - "95" + "50" ] } ] @@ -880,9 +775,9 @@ "value": "NumberVariable" }, "parameters": [ - "NRNG.zscore", + "ZScore", ">", - "-NRNG.pot01" + "-OneTail.p450" ] } ], @@ -892,9 +787,9 @@ "value": "SetNumberVariable" }, "parameters": [ - "NRNG.pCheck", + "pCheck", "=", - "99" + "55" ] } ] @@ -907,9 +802,9 @@ "value": "NumberVariable" }, "parameters": [ - "NRNG.zscore", + "ZScore", ">", - "3" + "-OneTail.p417" ] } ], @@ -919,43 +814,24 @@ "value": "SetNumberVariable" }, "parameters": [ - "NRNG.pCheck", + "pCheck", "=", - "100" + "58.33" ] } ] - } - ] - }, - { - "folded": true, - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "StringVariable" - }, - "parameters": [ - "Type", - "=", - "\"TwoTails\"" - ] - } - ], - "actions": [], - "events": [ + }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "BuiltinCommonInstructions::CompareNumbers" + "value": "NumberVariable" }, "parameters": [ - "abs(NRNG.zscore)", - "<", - "NRNG.ptt01" + "ZScore", + ">", + "-OneTail.p400" ] } ], @@ -965,9 +841,9 @@ "value": "SetNumberVariable" }, "parameters": [ - "NRNG.pCheck", + "pCheck", "=", - "50.0" + "60" ] } ] @@ -977,12 +853,12 @@ "conditions": [ { "type": { - "value": "BuiltinCommonInstructions::CompareNumbers" + "value": "NumberVariable" }, "parameters": [ - "abs(NRNG.zscore)", + "ZScore", ">", - "NRNG.ptt01" + "-OneTail.p375" ] } ], @@ -992,9 +868,9 @@ "value": "SetNumberVariable" }, "parameters": [ - "NRNG.pCheck", + "pCheck", "=", - "50.5" + "62.5" ] } ] @@ -1004,12 +880,12 @@ "conditions": [ { "type": { - "value": "BuiltinCommonInstructions::CompareNumbers" + "value": "NumberVariable" }, "parameters": [ - "abs(NRNG.zscore)", + "ZScore", ">", - "NRNG.ptt05" + "-OneTail.p350" ] } ], @@ -1019,9 +895,9 @@ "value": "SetNumberVariable" }, "parameters": [ - "NRNG.pCheck", + "pCheck", "=", - "52.5" + "65" ] } ] @@ -1031,12 +907,12 @@ "conditions": [ { "type": { - "value": "BuiltinCommonInstructions::CompareNumbers" + "value": "NumberVariable" }, "parameters": [ - "abs(NRNG.zscore)", + "ZScore", ">", - "NRNG.ptt10" + "-OneTail.p333" ] } ], @@ -1046,9 +922,9 @@ "value": "SetNumberVariable" }, "parameters": [ - "NRNG.pCheck", + "pCheck", "=", - "55.0" + "66.66" ] } ] @@ -1058,12 +934,12 @@ "conditions": [ { "type": { - "value": "BuiltinCommonInstructions::CompareNumbers" + "value": "NumberVariable" }, "parameters": [ - "abs(NRNG.zscore)", + "ZScore", ">", - "NRNG.ptt20" + "-OneTail.p300" ] } ], @@ -1073,9 +949,9 @@ "value": "SetNumberVariable" }, "parameters": [ - "NRNG.pCheck", + "pCheck", "=", - "60.0" + "70" ] } ] @@ -1085,12 +961,12 @@ "conditions": [ { "type": { - "value": "BuiltinCommonInstructions::CompareNumbers" + "value": "NumberVariable" }, "parameters": [ - "abs(NRNG.zscore)", + "ZScore", ">", - "NRNG.ptt25" + "-OneTail.p250" ] } ], @@ -1100,9 +976,9 @@ "value": "SetNumberVariable" }, "parameters": [ - "NRNG.pCheck", + "pCheck", "=", - "62.5" + "75" ] } ] @@ -1112,12 +988,12 @@ "conditions": [ { "type": { - "value": "BuiltinCommonInstructions::CompareNumbers" + "value": "NumberVariable" }, "parameters": [ - "abs(NRNG.zscore)", + "ZScore", ">", - "NRNG.ptt33" + "-OneTail.p200" ] } ], @@ -1127,9 +1003,9 @@ "value": "SetNumberVariable" }, "parameters": [ - "NRNG.pCheck", + "pCheck", "=", - "66.7" + "80" ] } ] @@ -1139,12 +1015,12 @@ "conditions": [ { "type": { - "value": "BuiltinCommonInstructions::CompareNumbers" + "value": "NumberVariable" }, "parameters": [ - "abs(NRNG.zscore)", + "ZScore", ">", - "NRNG.ptt50" + "-OneTail.p167" ] } ], @@ -1154,9 +1030,9 @@ "value": "SetNumberVariable" }, "parameters": [ - "NRNG.pCheck", + "pCheck", "=", - "75.0" + "83.33" ] } ] @@ -1166,12 +1042,12 @@ "conditions": [ { "type": { - "value": "BuiltinCommonInstructions::CompareNumbers" + "value": "NumberVariable" }, "parameters": [ - "abs(NRNG.zscore)", + "ZScore", ">", - "NRNG.ptt60" + "-OneTail.p150" ] } ], @@ -1181,9 +1057,9 @@ "value": "SetNumberVariable" }, "parameters": [ - "NRNG.pCheck", + "pCheck", "=", - "80.0" + "85" ] } ] @@ -1193,12 +1069,12 @@ "conditions": [ { "type": { - "value": "BuiltinCommonInstructions::CompareNumbers" + "value": "NumberVariable" }, "parameters": [ - "abs(NRNG.zscore)", + "ZScore", ">", - "NRNG.ptt66" + "-OneTail.p125" ] } ], @@ -1208,9 +1084,9 @@ "value": "SetNumberVariable" }, "parameters": [ - "NRNG.pCheck", + "pCheck", "=", - "83.3" + "87.5" ] } ] @@ -1220,12 +1096,12 @@ "conditions": [ { "type": { - "value": "BuiltinCommonInstructions::CompareNumbers" + "value": "NumberVariable" }, "parameters": [ - "abs(NRNG.zscore)", + "ZScore", ">", - "NRNG.ptt75" + "-OneTail.p100" ] } ], @@ -1235,9 +1111,9 @@ "value": "SetNumberVariable" }, "parameters": [ - "NRNG.pCheck", + "pCheck", "=", - "87.5" + "90" ] } ] @@ -1247,12 +1123,12 @@ "conditions": [ { "type": { - "value": "BuiltinCommonInstructions::CompareNumbers" + "value": "NumberVariable" }, "parameters": [ - "abs(NRNG.zscore)", + "ZScore", ">", - "NRNG.ptt80" + "-OneTail.p083" ] } ], @@ -1262,9 +1138,9 @@ "value": "SetNumberVariable" }, "parameters": [ - "NRNG.pCheck", + "pCheck", "=", - "90.0" + "91.67" ] } ] @@ -1274,12 +1150,12 @@ "conditions": [ { "type": { - "value": "BuiltinCommonInstructions::CompareNumbers" + "value": "NumberVariable" }, "parameters": [ - "abs(NRNG.zscore)", + "ZScore", ">", - "NRNG.ptt90" + "-OneTail.p050" ] } ], @@ -1289,9 +1165,9 @@ "value": "SetNumberVariable" }, "parameters": [ - "NRNG.pCheck", + "pCheck", "=", - "95.0" + "95" ] } ] @@ -1301,12 +1177,12 @@ "conditions": [ { "type": { - "value": "BuiltinCommonInstructions::CompareNumbers" + "value": "NumberVariable" }, "parameters": [ - "abs(NRNG.zscore)", + "ZScore", ">", - "NRNG.ptt95" + "-OneTail.p025" ] } ], @@ -1316,7 +1192,7 @@ "value": "SetNumberVariable" }, "parameters": [ - "NRNG.pCheck", + "pCheck", "=", "97.5" ] @@ -1328,12 +1204,12 @@ "conditions": [ { "type": { - "value": "BuiltinCommonInstructions::CompareNumbers" + "value": "NumberVariable" }, "parameters": [ - "abs(NRNG.zscore)", + "ZScore", ">", - "NRNG.ptt99" + "-OneTail.p010" ] } ], @@ -1343,9 +1219,9 @@ "value": "SetNumberVariable" }, "parameters": [ - "NRNG.pCheck", + "pCheck", "=", - "99.5" + "99" ] } ] @@ -1355,10 +1231,10 @@ "conditions": [ { "type": { - "value": "BuiltinCommonInstructions::CompareNumbers" + "value": "NumberVariable" }, "parameters": [ - "abs(NRNG.zscore)", + "ZScore", ">", "3" ] @@ -1370,15 +1246,208 @@ "value": "SetNumberVariable" }, "parameters": [ - "NRNG.pCheck", + "pCheck", "=", "100" ] } ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Type", + "=", + "\"bigger\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "pCheck" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "Type", + "=", + "\"smaller\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "100-pCheck" + ] + } + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Number to be checked", + "name": "NumberToCheck", + "type": "expression" + }, + { + "description": "Mean", + "name": "Mean", + "type": "expression" + }, + { + "description": "Standard deviation (1 sigma)", + "name": "StdDev", + "type": "expression" + }, + { + "description": "Type of check", + "name": "Type", + "supplementaryInformation": "[\"bigger\",\"smaller\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": "if the number is different from a given normal distibution with confidence.", + "fullName": "Two-Tail test", + "functionType": "Condition", + "name": "TwoTails", + "sentence": "_PARAM1_ is different to the normal distribution (Mean:_PARAM2_; StdDev:_PARAM3_) at a _PARAM4_ confidence level", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::CompareNumbers" + }, + "parameters": [ + "abs(Statistics::ZScore(NumberToCheck,Mean,StdDev))", + ">=", + "TwoTails[Confidence]" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetReturnBoolean" + }, + "parameters": [ + "True" + ] + } + ] + } + ], + "parameters": [ + { + "description": "Number to be checked", + "name": "NumberToCheck", + "type": "expression" + }, + { + "description": "Mean", + "name": "Mean", + "type": "expression" + }, + { + "description": "Standard deviation (1 sigma)", + "name": "StdDev", + "type": "expression" + }, + { + "description": "Confidence level (p950 recommended)", + "name": "Confidence", + "supplementaryInformation": "[\"p683\",\"p750\",\"p900\",\"p950\",\"p990\",\"p997\",\"p999\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "description": " the probability of being inside a range.", + "fullName": "Probability range", + "functionType": "ExpressionAndCondition", + "name": "Range", + "sentence": "The probability between _PARAM1_ and _PARAM2_ in a normal distribution (Mean:_PARAM3_; StdDev:_PARAM4_)", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "Statistics::OneTail(Max, Mean, StdDev, \"bigger\") - Statistics::OneTail(Min, Mean, StdDev, \"bigger\")" + ] } ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [ + { + "description": "Lower limit of the range", + "name": "Min", + "type": "expression" + }, + { + "description": "Upper limit of the range", + "name": "Max", + "type": "expression" + }, + { + "description": "Mean", + "name": "Mean", + "type": "expression" }, + { + "description": "Standard deviation (1 sigma)", + "name": "StdDev", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": " the Z-Score of a number in a normal distribution.", + "fullName": "Z-Score", + "functionType": "ExpressionAndCondition", + "name": "ZScore", + "sentence": "The Z-Score of _PARAM1_ in the normal distribution (Mean:_PARAM2_; StdDev:_PARAM3_)", + "events": [ { "type": "BuiltinCommonInstructions::Standard", "conditions": [], @@ -1388,7 +1457,7 @@ "value": "SetReturnNumber" }, "parameters": [ - "NRNG.pCheck" + "(NumberToCheck-Mean)/StdDev" ] } ] @@ -1412,14 +1481,36 @@ "description": "Standard deviation (1 sigma)", "name": "StdDev", "type": "expression" - }, + } + ], + "objectGroups": [] + }, + { + "description": "Provides the Z value used for normal random number generation.", + "fullName": "Z-value", + "functionType": "Expression", + "name": "Zvalue", + "sentence": "", + "events": [ { - "description": "Type of check", - "name": "Type", - "supplementaryInformation": "[\"OneTail\",\"TwoTails\"]", - "type": "stringWithSelector" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnNumber" + }, + "parameters": [ + "(RandomFloat(1)+RandomFloat(1)+RandomFloat(1)+RandomFloat(1)+RandomFloat(1)+RandomFloat(1)+RandomFloat(1)+RandomFloat(1)+RandomFloat(1)+RandomFloat(1)+RandomFloat(1)+RandomFloat(1))-6" + ] + } + ] } ], + "expressionType": { + "type": "expression" + }, + "parameters": [], "objectGroups": [] } ],