Note: You are currently viewing documentation for Moodle 2.9. Up-to-date documentation for the latest stable version of Moodle may be available here: Grade calculations.

Grade calculations: Difference between revisions

From MoodleDocs
(→‎Setting a grade calculation: amended as suggested in http://moodle.org/mod/forum/discuss.php?d=137002)
(updating)
 
(14 intermediate revisions by 11 users not shown)
Line 1: Line 1:
{{Grades}}A grade calculation is a formula used to determine grades, based (optionally) on other grade items. Note that this is not the same as [[Calculated_question_type|Calculated question types]].
{{Managing grades}}
A grade calculation is a formula used to determine grades, based (optionally) on other grade items. Note that this is not the same as [[Calculated_question_type|Calculated question types]].


Calculations for the gradebook follow the pattern of formulas/functions in popular spreadsheet programs. They start with an equal (=) sign, and use common mathematical operators and functions to produce a single numerical output. This output is then used as the computed value for the grade item you are editing.


==Setting a grade calculation==
==Setting a grade calculation==
[[Image:Calc_icon.JPG|thumb|Calculator symbol]]To set a grade calculation:
[[Image:neweditcalculation.png|thumb|Edit calculation setting]]
# Login as teacher or other user with permission to edit grades.
[[Image:newcalculationgrade.png|thumb|Example calculation]]
# Click on Grades in the course administration block.
To set a grade calculation:
# Click the 'Categories and items' tab (or select it from the gradebook dropdown menu).
# Login as teacher or other user with permission to edit grades
# Click the 'calculator symbol' (in the 'Actions' column) opposite the grade category you wish to set a calculation for.
# Click on Grades in the course administration block
# Add the calculation then click the 'Save changes' button.
# Click the 'Categories and items'  
# Click the 'Edit settings' and then 'Edit calculation'. N ote: if you don't see this, then it must be enabled in ''Site administration>Grades>Report settings>Grader report''
# Start with an equal sign (=)
# Choose a function; Example: =sum()
# Plug in your ID numbers enclosed in double square brackets, for example <nowiki>=sum([[item1]][[item2]][[item3]])</nowiki>
# Separate each ID number with a comma, for example <nowiki>=sum([[item1]],[[item2]],[[item3]])</nowiki>
# Click the "Save Changes" button


==Assigning ID numbers==
==Assigning ID numbers==
ID numbers are similar to nicknames for each grade item. In a calculation, instead of referring back to a whole assignment name, we can substitute it for it's ID number which becomes a lot easier. Think of it as substituting 143 as X and then using X for various math problems.


ID numbers on the bottom of the page. Use simple to remember numbers or variables like 1, X, or Quiz1. Remember to click "Add id numbers"!
You can include the values of other grade items by using their ID number as references in your formulas. The ID number is surrounded by double square brackets, for example if you have a grade item with Quiz.3 as ID number, you will refer to this item as <nowiki>[[Quiz.3]]</nowiki> in your calculation.
 
Below the calculation field is a list of your course with its grade categories and grade items. Next to each item or category's total is displayed the ID number you can use in your calculation (already surrounded with double square brackets). However, since the ID number is optional, some items may not yet have one. These items without an ID number have instead a form field which lets you enter an ID number directly.


==Understanding calculation functions==
As soon as you have assigned the ID numbers you need, you can click the "Add ID numbers" button, and the page will reload and show you the same list with the ID numbers you have just assigned.
Click the yellow question mark next to the word "Calculation". This will bring a pop-up explaining the various functions that can be used in calculations and how to use them.
 
==Calculation functions==


Every calculation must start with an equal sign (=). Following is a list of the functions supported by the calculation. The comma (,) character is used to separate arguments within function brackets. The comma can also be used to separate different functions. (The separator character could be a semicolon (;) in other languages, see below).
Every calculation must start with an equal sign (=). Following is a list of the functions supported by the calculation. The comma (,) character is used to separate arguments within function brackets. The comma can also be used to separate different functions. (The separator character could be a semicolon (;) in other languages, see below).
Line 27: Line 37:
* power(base, power): Raises a number to the power of another
* power(base, power): Raises a number to the power of another
* round(number, count): Rounds a number to a predefined accuracy
* round(number, count): Rounds a number to a predefined accuracy
* floor(number): Maps a real number to the largest previous integer
* ceil(number): Maps a real number to the smallest following integer
* sum(<nowiki>[[item1]], [[item2]]...)</nowiki>: Returns the sum of all arguments
* sum(<nowiki>[[item1]], [[item2]]...)</nowiki>: Returns the sum of all arguments
* an asterisk (*) gives the product of two items: <nowiki>[[item1]]*[[item2]]</nowiki>
* an asterisk (*) gives the product of two items: <nowiki>[[item1]]*[[item2]]</nowiki>
Line 56: Line 68:
* exp
* exp


==Making your calculation==
==Example calculations==
[[Image:Final_calc.JPG|thumb|Example calculation]]
Back on the calculations page, start typing the various functions and the ID numbers chosen for your calculation.


# Start with an equal sign (=)
* <nowiki>=average([[Quiz.1]], [[Quiz.4]], [[Assignment.1]])</nowiki>
# Choose a function; Example: =sum()
* <nowiki>=average(max([[Quiz.1]], [[Quiz.4]], [[Assignment.1]]), min([[Quiz.1]], [[Quiz.4]], [[Assignment.1]]))</nowiki>
# Plug in your ID numbers enclosed in 2 hard brackets; Example: <nowiki>=sum([[item1]][[item2]][[item3]])</nowiki>
* Weighted grade calculations where item 1 is weighted 30%, item 2 is weighted at 60% and item 3 is weighted at 200%: <nowiki>=sum([[1]]*0.3,[[2]]*0.6,[[3]]*2)</nowiki>
# Separate each ID number with a comma; Example: <nowiki>=sum([[item1]],[[item2]],[[item3]])</nowiki>
# Click the "Save Changes" button.


==Calculations when user language is not English==
==Calculations when user language is not English==


Calculation formulas use decimal and list separators as defined in each language pack.
Calculation formulas use decimal and list separators as defined in the [https://docs.moodle.org/dev/Translation_langconfig langconfig.php] file of each language pack.


The decimal separator (a symbol used to mark the boundary between the integral and the fractional parts of a decimal number) is a point (.) in English. In other languages it may be a comma (,).
The [http://en.wikipedia.org/wiki/Decimal_mark decimal separator] (a symbol used to mark the boundary between the integral and the fractional parts of a decimal number) is a point (.) in English. In other languages it may be a comma (,).


The list separator (a symbol used to separate a list of ID numbers in square brackets) is a comma (,) in English. In other languages it may be a semicolon (;).
The list separator (a symbol used to separate a list of ID numbers in square brackets) is a comma (,) in English. In other languages it may be a semicolon (;).
Line 77: Line 85:
*[http://www.youtube.com/watch?v=WKUGyzAXcyA Video on how to set up calculations in the gradebook (basic)]
*[http://www.youtube.com/watch?v=WKUGyzAXcyA Video on how to set up calculations in the gradebook (basic)]
*[http://www.youtube.com/watch?v=VBEj8mmu8lM Video on how to set up calculations in the gradebook (advanced)]
*[http://www.youtube.com/watch?v=VBEj8mmu8lM Video on how to set up calculations in the gradebook (advanced)]


[[ca:grade/edit/tree/calculation]]
[[ca:grade/edit/tree/calculation]]
[[fr:Calcul de notes]]
[[es:Cálculos de calificación]]
[[fr:Calcul de note]]
[[ru:Формулы и вычисления оценок]]
[[ja:評定計算]]
[[de:Bewertungen berechnen]]

Latest revision as of 17:05, 5 November 2014

A grade calculation is a formula used to determine grades, based (optionally) on other grade items. Note that this is not the same as Calculated question types.

Calculations for the gradebook follow the pattern of formulas/functions in popular spreadsheet programs. They start with an equal (=) sign, and use common mathematical operators and functions to produce a single numerical output. This output is then used as the computed value for the grade item you are editing.

Setting a grade calculation

Edit calculation setting
Example calculation

To set a grade calculation:

  1. Login as teacher or other user with permission to edit grades
  2. Click on Grades in the course administration block
  3. Click the 'Categories and items'
  4. Click the 'Edit settings' and then 'Edit calculation'. N ote: if you don't see this, then it must be enabled in Site administration>Grades>Report settings>Grader report
  5. Start with an equal sign (=)
  6. Choose a function; Example: =sum()
  7. Plug in your ID numbers enclosed in double square brackets, for example =sum([[item1]][[item2]][[item3]])
  8. Separate each ID number with a comma, for example =sum([[item1]],[[item2]],[[item3]])
  9. Click the "Save Changes" button

Assigning ID numbers

You can include the values of other grade items by using their ID number as references in your formulas. The ID number is surrounded by double square brackets, for example if you have a grade item with Quiz.3 as ID number, you will refer to this item as [[Quiz.3]] in your calculation.

Below the calculation field is a list of your course with its grade categories and grade items. Next to each item or category's total is displayed the ID number you can use in your calculation (already surrounded with double square brackets). However, since the ID number is optional, some items may not yet have one. These items without an ID number have instead a form field which lets you enter an ID number directly.

As soon as you have assigned the ID numbers you need, you can click the "Add ID numbers" button, and the page will reload and show you the same list with the ID numbers you have just assigned.

Calculation functions

Every calculation must start with an equal sign (=). Following is a list of the functions supported by the calculation. The comma (,) character is used to separate arguments within function brackets. The comma can also be used to separate different functions. (The separator character could be a semicolon (;) in other languages, see below).

  • average([[item1]], [[item2]]...): Returns the average of a sample
  • max([[item1]], [[item2]]...): Returns the maximum value in a list of arguments
  • min([[item1]], [[item2]]...): Returns the minimum value in a list of arguments
  • mod(dividend, divisor): Calculates the remainder of a division
  • pi(): Returns the value of the number Pi
  • power(base, power): Raises a number to the power of another
  • round(number, count): Rounds a number to a predefined accuracy
  • floor(number): Maps a real number to the largest previous integer
  • ceil(number): Maps a real number to the smallest following integer
  • sum([[item1]], [[item2]]...): Returns the sum of all arguments
  • an asterisk (*) gives the product of two items: [[item1]]*[[item2]]

A number of mathematical functions is also supported:

  • sin
  • sinh
  • arcsin
  • asin
  • arcsinh
  • asinh
  • cos
  • cosh
  • arccos
  • acos
  • arccosh
  • acosh
  • tan
  • tanh
  • arctan
  • atan
  • arctanh
  • atanh
  • sqrt
  • abs
  • ln
  • log
  • exp

Example calculations

  • =average([[Quiz.1]], [[Quiz.4]], [[Assignment.1]])
  • =average(max([[Quiz.1]], [[Quiz.4]], [[Assignment.1]]), min([[Quiz.1]], [[Quiz.4]], [[Assignment.1]]))
  • Weighted grade calculations where item 1 is weighted 30%, item 2 is weighted at 60% and item 3 is weighted at 200%: =sum([[1]]*0.3,[[2]]*0.6,[[3]]*2)

Calculations when user language is not English

Calculation formulas use decimal and list separators as defined in the langconfig.php file of each language pack.

The decimal separator (a symbol used to mark the boundary between the integral and the fractional parts of a decimal number) is a point (.) in English. In other languages it may be a comma (,).

The list separator (a symbol used to separate a list of ID numbers in square brackets) is a comma (,) in English. In other languages it may be a semicolon (;).

See also