This class has methods to compute the question statistics from the raw data.
More...
This class has methods to compute the question statistics from the raw data.
- Copyright
- 2013 Open University
- Author
- Jamie Pratt me@ja.nosp@m.miep.nosp@m..org
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ __construct()
core_question\statistics\questions\calculator::__construct |
( |
| $questions, |
|
|
| $progress = null ) |
Constructor.
- Parameters
-
| object[] | questions to analyze, keyed by slot, also analyses sub questions for random questions. we expect some extra fields - slot, maxmark and number on the full question data objects. |
core\progress\base | null | $progress | the element to send progress messages to, default is core\progress\none. |
◆ calculate()
core_question\statistics\questions\calculator::calculate |
( |
| $qubaids | ) |
|
Calculate the stats.
- Parameters
-
- Return values
-
all_calculated_for_qubaid_condition | The calculated stats. |
◆ get_cached()
core_question\statistics\questions\calculator::get_cached |
( |
| $qubaids | ) |
|
Load cached statistics from the database.
- Parameters
-
- Return values
-
all_calculated_for_qubaid_condition | The cached stats. |
◆ get_last_calculated_time()
core_question\statistics\questions\calculator::get_last_calculated_time |
( |
| $qubaids | ) |
|
Find time of non-expired statistics in the database.
- Parameters
-
- Return values
-
int|bool | Time of cached record that matches this qubaid_condition or false is non found. |
◆ get_latest_steps()
core_question\statistics\questions\calculator::get_latest_steps |
( |
| $qubaids | ) |
|
|
protected |
Get the latest step data from the db, from which we will calculate stats.
- Parameters
-
- Return values
-
array | with two items
- $lateststeps array of latest step data for the question usages
- $summarks array of total marks for each usage, indexed by usage id
|
◆ get_random_guess_score()
core_question\statistics\questions\calculator::get_random_guess_score |
( |
| $questiondata | ) |
|
|
protected |
Given the question data find the average grade that random guesses would get.
- Parameters
-
object | $questiondata | the full question object. |
- Return values
-
float | the random guess score for this question. |
◆ get_sum_of_mark_variance()
core_question\statistics\questions\calculator::get_sum_of_mark_variance |
( |
| ) |
|
Used when computing Coefficient of Internal Consistency by quiz statistics.
- Return values
-
◆ initial_question_walker()
core_question\statistics\questions\calculator::initial_question_walker |
( |
| $stats | ) |
|
|
protected |
Then loop through all questions for the first time.
Perform some computations on the per-question statistics calculations after we have been through all the step data.
- Parameters
-
calculated | $stats | question stats to update. |
◆ initial_steps_walker()
core_question\statistics\questions\calculator::initial_steps_walker |
( |
| $step, |
|
|
| $stats, |
|
|
| $summarks, |
|
|
| $positionstat = true, |
|
|
| $dovariantalso = true ) |
|
protected |
Calculating the stats is a four step process.
We loop through all 'last step' data first.
Update $stats->totalmarks, $stats->markarray, $stats->totalothermarks and $stats->othermarksarray to include another state.
- Parameters
-
object | $step | the state to add to the statistics. |
calculated | $stats | the question statistics we are accumulating. |
array | $summarks | of the sum of marks for each question usage, indexed by question usage id |
bool | $positionstat | whether this is a statistic of position of question. |
bool | $dovariantalso | do we also want to do the same calculations for this variant? |
◆ secondary_question_walker()
core_question\statistics\questions\calculator::secondary_question_walker |
( |
| $stats | ) |
|
|
protected |
And finally loop through all the questions again.
Perform more per-question statistics calculations.
- Parameters
-
calculated | $stats | question stats to update. |
◆ secondary_steps_walker()
core_question\statistics\questions\calculator::secondary_steps_walker |
( |
| $step, |
|
|
| $stats, |
|
|
| $summarks ) |
|
protected |
Loop through all last step data again.
Now we know the averages, accumulate the date needed to compute the higher moments of the question scores.
- Parameters
-
object | $step | the state to add to the statistics. |
calculated | $stats | the question statistics we are accumulating. |
float[] | $summarks | of the sum of marks for each question usage, indexed by question usage id |
◆ $randomselectors
array [] core_question\statistics\questions\calculator::$randomselectors = array() |
|
protected |
The documentation for this class was generated from the following file:
- question/classes/statistics/questions/calculator.php