This repository is made for solutions involving software from NewCompliance B.V Group
The functions included in this library will calculate deviation and correlation in from a JSON file.
The demo included will give you an example on how to make use of this library
Require the library in your composer.json
composer require wesleyk079/statistic_functionalities "dev-master"
Make sure your framework or php-script loads the 'autoload.php' from composer's vendor directory.
Include the library:
Use 'statisticFunctionalities\functions\Deviation';
Adjust the options as wanted
//example for setting the options
$options = [
"FileToCheck" => json_decode(file_get_contents("../generatedFiles/generatedInformation.json")),
"KeyToSelect" => "Verrichting 1",
"KeyToSearchFor" => "Operatieduur",
"RemoveOutliers" => true,
"SecondComparison" => true,
"SecondKeyToFindDeviation" => "Geplande duur",
"FirstCategoryMax" => 20,
"MiddleCategoryMax" => 60,
"FirstPercentageMeasure" => 20,
"MiddlePercentageMeasure" => 12.5,
"LastPercentageMeasure" => 10,
"PositiveFeedback" => "Wel goed in te schatten",
"NegativeFeedback" => "Niet goed in te schatten"
];
Initialize the deviation class
$deviation = new statisticFunctions\Deviation($options);
Get the results
$deviationResults = $deviation->GetDeviationStatistics();
The following keys will be available from all results in the returned array
amount - the amount of measured cases
mean - the mean of all meaasured numbers
standardDev - standard deviation (1 time)
statisticMin - mean - (standarddeviation * 3)
statisticMax - mean + (standarddeviation * 3)
lowerThanComparison - Amount of cases where the number lower than the comparison number
higherThanComparison - Amount of cases where the number was higher than the comparison number
Advice - Advice as stated at the settings (positive or negative feedback). If (standarddeviation * 3) is smaller than (mean * percentage), it will be positive. The percentage will be taken from the percentageMeasure based on categories.
foreach($deviationResults as $result){
<p>
There were <?= $operation["amount"] ?> cases that included '<?= $caseTitle ?>' as <?= $options["KeyToSelect"] ?>.
The data was divided by a standard deviation of ' ~ <?= intval($operation["standardDev"]) ?>'
</p>
<p>
This means in 68.26% of the cases, <?= $options["KeyToSearchFor"] ?> will be
between <?= intval($operation["mean"] - $operation["standardDev"] * 1)
?>
}
Change options to your personal wishes and settings
Include the library:
Use 'statisticFunctionalities\functions\Correlation';
Adjust the options as wanted
//example for setting the options
$options = [
"FileToCheck" => json_decode(file_get_contents("../generatedFiles/generatedInformation.json")),
"KeyToSearchFor" => "Operatieduur",
"KeyToSelect" => "Verrichting 1",
"ValueForKeyToSelect" => "Verwijderen buisjes uit oren",
"ExcludeKeywords" => ["Patiëntnummer", "Casusnummer"]
];
Initialize the deviation class
$correlation = new statisticFunctions\Correlation($options);
Get the results
$results = $correlation->calculateCorrelations();
yTitle - Title of the y-axis that was being measured
coefficient - the correlation coefficient between the values of xTitle and yTitle
<!--Example on how to treat the data-->
<?php foreach ($all as $result): ?>
<?= $correlation->getCorrelationAdvise($result["coefficient"], $result["xTitle"], $result["yTitle"]); ?><br/><br/>
//Result: The variable 'Operatieduur' looks like growing when 'Wond open (min)' is higher. The correlation is stated as moderate correlation: 0.51029910576627
<?php endforeach; ?>