2

I just started working in R-exams package to prepare a set of dynamic questions. I am puzzled with the command "extol" in Meta information of the exercise:

Meta-information
================
extol: 0.01   

For instance, in the example above, what exactly does "extol=0.01" mean? Is 0.01 a percent of the amount that is tolerable? And where could I possibly get detailed information on tolerance specification "extol" in r-exams package?

Is it actually possible to set the tolerance as the percentage of the amount?

Joker312
  • 59
  • 5

1 Answers1

1

The extol meta-information sets the absolute tolerance of the exsolution. Thus, exsolution plus/mins extol is the interval which is accepted as correct.

To set a relative tolerance you can use the num_to_tol() function which converts a numeric solution to an absolute tolerance. It also assures a certain minimal tolerance. See the source code for the precise computation:

num_to_tol
## function (x, reltol = 2e-04, min = 0.01, digits = 2) 
## pmax(min, round(reltol * abs(x), digits = digits))

This function is useful if the order of magnitude of the correct answer can change substantially across different random replications:

exams::num_to_tol(10)
## [1] 0.01
exams::num_to_tol(100)
## [1] 0.02
## exams::num_to_tol(1000)
## [1] 0.2
exams::num_to_tol(10000)
## [1] 2

The default of reltol = 2e-04 and min = 0.01 was chosen based on our needs and experiences in our own exams. You might prefer different specifications, of course.

To apply it in a given exercise for a solution in a variable sol, say, you typically do:

exsolution: `r sol`
extol: `r num_to_tol(sol)`
Achim Zeileis
  • 15,710
  • 1
  • 39
  • 49
  • 1
    Thanks a lot for your answer! It seems to be working perfectly. I just specified ```extol: `r num_to_tol(Value, reltol=2e-02, min=0.01, digits=2)` ``` – Joker312 Jun 10 '22 at 10:29