Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Public Attributes | Protected Attributes | List of all members
core_question\statistics\questions\calculated Class Reference

This class is used to return the stats as calculated by core_question\statistics\questions\calculator. More...

Inheritance diagram for core_question\statistics\questions\calculated:
core_question\statistics\questions\calculated_for_subquestion core_question\statistics\questions\calculated_question_summary

Public Member Functions

 __construct ($question=null, $slot=null, $variant=null)
 Set up a calculated instance ready to store a question's (or a variant of a slot's question's) stats for one slot in the quiz. More...
 
 break_down_by_variant ()
 Do we break down the stats for this question by variant or not? More...
 
 cache ($qubaids)
 Cache calculated stats stored in this object in 'question_statistics' table. More...
 
 clear_variants ()
 Delete the data structure for storing variant stats.
 
 get_sub_question_ids ()
 Get any sub question ids for this question. More...
 
 get_variants ()
 Array of variants that have appeared in the attempt data for this question. More...
 
 populate_from_record ($record)
 Load properties of this class from db record. More...
 
 random_selector_string ()
 Used to determine which random questions pull sub questions from the same pools. More...
 
 sort_variants ()
 Sort the variants of this question by variant number.
 

Public Attributes

 $covariance
 
 $covariancemax
 
 $covariancemaxsum = 0
 
 $covariancesum = 0
 
 $covariancewithoverallmark
 
 $covariancewithoverallmarksum = 0
 
float $discriminationindex
 
float $discriminativeefficiency
 
float $effectiveweight
 effective weight of this question.
 
float $facility
 
 $markarray = array()
 
 $markaverage
 
 $markvariance
 
 $markvariancesum = 0
 
float $maxmark
 max mark achievable for this question.
 
string $minmedianmaxnotice = ''
 if this stat has been picked as a min, median or maximum facility value then this string says which stat this is. More...
 
bool $negcovar
 is covariance of this questions mark with other question marks negative?
 
 $othermarkaverage
 
 $othermarksarray = array()
 
 $othermarkvariance
 
 $othermarkvariancesum = 0
 
string $positions
 comma separated list of the positions in which this question appears.
 
object $question
 full question data
 
 $questionid
 
null float $randomguessscore = null
 The average score that students would have got by guessing randomly. More...
 
int $s = 0
 total attempts at this question.
 
float $sd
 standard deviation
 
 $slot = null
 
bool $subquestion = false
 is this a sub question.
 
 $subquestions = ''
 
float $summarksaverage
 The average for all attempts, of the sum of the marks for all positions in which this item appeared.
 
integer $timemodified
 Set if this record has been retrieved from cache. More...
 
 $totalmarks = 0
 
 $totalothermarks = 0
 
float $totalsummarks = 0
 The total of marks achieved for all positions in all attempts where this item was seen.
 
null integer $variant = null
 if this property is not null then this is the stats for a variant of a question or when inherited by calculated_for_subquestion and not null then this is the stats for a variant of a sub question.
 
calculated[] $variantstats = array()
 An array of calculated stats for each variant of the question. More...
 

Protected Attributes

 $fieldsindb
 

Detailed Description

This class is used to return the stats as calculated by core_question\statistics\questions\calculator.

Author
Jamie Pratt me@ja.nosp@m.miep.nosp@m..org
License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

core_question\statistics\questions\calculated::__construct (   $question = null,
  $slot = null,
  $variant = null 
)

Set up a calculated instance ready to store a question's (or a variant of a slot's question's) stats for one slot in the quiz.

Parameters
null | object$question
null | int$slot
null | int$variant

Reimplemented in core_question\statistics\questions\calculated_question_summary.

Member Function Documentation

◆ break_down_by_variant()

core_question\statistics\questions\calculated::break_down_by_variant ( )

Do we break down the stats for this question by variant or not?

Return values
boolDo we?

Reimplemented in core_question\statistics\questions\calculated_question_summary.

◆ cache()

core_question\statistics\questions\calculated::cache (   $qubaids)

Cache calculated stats stored in this object in 'question_statistics' table.

Parameters
qubaid_condition$qubaids

◆ get_sub_question_ids()

core_question\statistics\questions\calculated::get_sub_question_ids ( )

Get any sub question ids for this question.

Return values
int[]array of sub-question ids or empty array if there are none.

◆ get_variants()

core_question\statistics\questions\calculated::get_variants ( )

Array of variants that have appeared in the attempt data for this question.

Or an empty array if there is only one variant.

Return values
int[]the variant nos.

◆ populate_from_record()

core_question\statistics\questions\calculated::populate_from_record (   $record)

Load properties of this class from db record.

Parameters
object$recordGiven a record from 'question_statistics' copy stats from record to properties.

◆ random_selector_string()

core_question\statistics\questions\calculated::random_selector_string ( )

Used to determine which random questions pull sub questions from the same pools.

Where pool means category and possibly all the sub categories of that category.

Return values
null|stringrepresents the pool of questions from which this question draws if it is random, or null if not.

Member Data Documentation

◆ $fieldsindb

core_question\statistics\questions\calculated::$fieldsindb
protected
Initial value:
= array('questionid', 'slot', 'subquestion', 's', 'effectiveweight', 'negcovar', 'discriminationindex',
'discriminativeefficiency', 'sd', 'facility', 'subquestions', 'maxmark', 'positions', 'randomguessscore', 'variant')

◆ $minmedianmaxnotice

string core_question\statistics\questions\calculated::$minmedianmaxnotice = ''

if this stat has been picked as a min, median or maximum facility value then this string says which stat this is.

Prepended to question name for display.

◆ $randomguessscore

null float core_question\statistics\questions\calculated::$randomguessscore = null

The average score that students would have got by guessing randomly.

Or null if not calculable.

◆ $timemodified

integer core_question\statistics\questions\calculated::$timemodified

Set if this record has been retrieved from cache.

This is the time that the statistics were calculated.

◆ $variantstats

calculated [] core_question\statistics\questions\calculated::$variantstats = array()

An array of calculated stats for each variant of the question.

Even when there is just one variant we still calculate this data as there is no way to know if there are variants before we have finished going through the attempt data one time.

$variants


The documentation for this class was generated from the following file: