PHP Classes

PHP Statistical Analysis using Data Inference: Analyze a set of numbers to extract statistics

Recommend this page to a friend!
  Info   View files Example   View files View files (41)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 95 All time: 9,842 This week: 107Up
Version License PHP version Categories
data-inferensi 1.0The PHP License5PHP 5
Description 

Author

This class can analyze a set of numbers to extract statistics.

It can take an array of data and perform several types of statistical analysis. Currently it can compute:

- First, the second and the third quartile
- Variance
- Mean
- Median
- Modus
- Standard Deviation

Picture of Fentyka Ayu
Name: Fentyka Ayu <contact>
Classes: 1 package by
Country: Indonesia Indonesia
Age: ???
All time rank: 441479 in Indonesia Indonesia
Week rank: 4375 Up79 in Indonesia Indonesia Equal

Example

<?php
include "Statistic.php";?>
<html>
    <head>
        <title>Data Statistic</title>
        <script src="Chart.bundle.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.3.0/Chart.bundle.js"></script>
        <style type="text/css">
            .container {
                width: 50%;
                margin: 15px auto;
            }
        </style>
    </head>
    <body><!doctype html>
<html>

<head>
    <title>Data Statistic</title>
    <script src="../Chart.bundle.js"></script>
    <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>

    <style>
    canvas{
        -moz-user-select: none;
        -webkit-user-select: none;
        -ms-user-select: none;
    }
    </style>
</head>

<body>
    <div style="width:75%;">
        <canvas id="canvas"></canvas>

       


    </div>
    <script>
        var Data = ["Q1", "Q2", "Q3", "Mean", "Varian", "Std Deviasi", "Modus", "Median"];
       
        var randomScalingFactor = function() {
            return Math.round(Math.random() * 100);
            //return 0;
        };
        var randomColorFactor = function() {
            return Math.round(Math.random() * 255);
        };
        var randomColor = function(opacity) {
            return 'rgba(' + randomColorFactor() + ',' + randomColorFactor() + ',' + randomColorFactor() + ',' + (opacity || '.3') + ')';
        };

        var config = {
            type: 'line',
            data: {
                labels: ["Q1", "Q2", "Q3", "Mean", "Varian", "Std Deviasi", "Modus", "Median"],
                datasets: [{
                    label: "Data",
                    data: [
                    <?php echo $statistic->q1($data) ?>,
                    <?php echo $statistic->q2($data) ?>,
                    <?php echo $statistic->q3($data) ?>,
                    <?php echo $statistic->mean($data) ?>,
                    <?php echo $statistic->Varian($data) ?>,
                    <?php echo $statistic->std_deviasi($data) ?>,
                    <?php echo count($statistic->modus($data)) ?>,
                    <?php echo $statistic->median($data) ?>,


                    ],
                    fill: false,
                    borderDash: [5, 5],
                }]
            },
            options: {
                responsive: true,
                title:{
                    display:true,
                    text:'Analisis Data'

                },
                tooltips: {
                    mode: 'label',
                    callbacks: {
                        // beforeTitle: function() {
                        // return '...beforeTitle';
                        // },
                        // afterTitle: function() {
                        // return '...afterTitle';
                        // },
                        // beforeBody: function() {
                        // return '...beforeBody';
                        // },
                        // afterBody: function() {
                        // return '...afterBody';
                        // },
                        // beforeFooter: function() {
                        // return '...beforeFooter';
                        // },
                        // footer: function() {
                        // return 'Footer';
                        // },
                        // afterFooter: function() {
                        // return '...afterFooter';
                        // },
                    }
                },
                hover: {
                    mode: 'dataset'
                },
                scales: {
                    xAxes: [{
                        display: true,
                        scaleLabel: {
                            display: true,
                            labelString: 'Data'
                        }
                    }],
                    yAxes: [{
                        display: true,
                        scaleLabel: {
                            display: true,
                            labelString: 'Value'
                        },
                        ticks: {
                            suggestedMin: 1,
                            suggestedMax: <?php echo $statistic->get_total_data($data) ?>,
                        }
                    }]
                }
            }
        };

        $.each(config.data.datasets, function(i, dataset) {
            dataset.borderColor = randomColor(0.4);
            dataset.backgroundColor = randomColor(0.5);
            dataset.pointBorderColor = randomColor(0.7);
            dataset.pointBackgroundColor = randomColor(0.5);
            dataset.pointBorderWidth = 1;
        });

        window.onload = function() {
            var ctx = document.getElementById("canvas").getContext("2d");
            window.myLine = new Chart(ctx, config);
        };


       
    </script>
</body>



  Files folder image Files  
File Role Description
Files folder imagesamples (30 files, 2 directories)
Accessible without login Plain text file Chart.bundle.js Data Auxiliary data
Accessible without login Plain text file Chart.bundle.min.js Data Auxiliary data
Accessible without login Plain text file Chart.js Data Auxiliary data
Accessible without login Plain text file Chart.min.js Data Auxiliary data
Accessible without login Plain text file index.php Example Example script
Plain text file raw2table.php Class Class source
Plain text file Statistic.php Class Class source

  Files folder image Files  /  samples  
File Role Description
Files folder imageAnimationCallbacks (1 file)
Files folder imagetimeScale (3 files)
  Accessible without login HTML file bar-horizontal.html Doc. Documentation
  Accessible without login HTML file bar-multi-axis.html Doc. Documentation
  Accessible without login HTML file bar-stacked.html Doc. Documentation
  Accessible without login HTML file bar.html Doc. Documentation
  Accessible without login HTML file bubble.html Doc. Documentation
  Accessible without login HTML file combo-bar-line.html Doc. Documentation
  Accessible without login HTML file data_label_combo-bar-line.html Doc. Documentation
  Accessible without login HTML file different-point-sizes.html Doc. Documentation
  Accessible without login HTML file doughnut.html Doc. Documentation
  Accessible without login HTML file line-cubicInterpolationMode.html Doc. Documentation
  Accessible without login HTML file line-customTooltips.html Doc. Documentation
  Accessible without login HTML file line-legend.html Doc. Documentation
  Accessible without login HTML file line-logarithmic.html Doc. Documentation
  Accessible without login HTML file line-multi-axis.html Doc. Documentation
  Accessible without login HTML file line-multiline-labels.html Doc. Documentation
  Accessible without login HTML file line-non-numeric-y.html Doc. Documentation
  Accessible without login HTML file line-skip-points.html Doc. Documentation
  Accessible without login HTML file line-stacked-area.html Doc. Documentation
  Accessible without login HTML file line-stepped.html Doc. Documentation
  Accessible without login HTML file line-x-axis-filter.html Doc. Documentation
  Accessible without login HTML file line.html Doc. Documentation
  Accessible without login HTML file pie-customTooltips.html Doc. Documentation
  Accessible without login HTML file pie.html Doc. Documentation
  Accessible without login HTML file polar-area.html Doc. Documentation
  Accessible without login HTML file radar-skip-points.html Doc. Documentation
  Accessible without login HTML file radar.html Doc. Documentation
  Accessible without login HTML file scatter-logX.html Doc. Documentation
  Accessible without login HTML file scatter-multi-axis.html Doc. Documentation
  Accessible without login HTML file scatter.html Doc. Documentation
  Accessible without login HTML file tooltip-hooks.html Doc. Documentation

  Files folder image Files  /  samples  /  AnimationCallbacks  
File Role Description
  Accessible without login HTML file progress-bar.html Doc. Documentation

  Files folder image Files  /  samples  /  timeScale  
File Role Description
  Accessible without login HTML file combo-time-scale.html Doc. Documentation
  Accessible without login HTML file line-time-point-data.html Doc. Documentation
  Accessible without login HTML file line-time-scale.html Doc. Documentation

 Version Control Unique User Downloads Download Rankings  
 100%
Total:95
This week:0
All time:9,842
This week:107Up