Flexible Generation of E-Learning Exams in R: Moodle Quizzes, OLAT Assessments, and Beyond
Total Page:16
File Type:pdf, Size:1020Kb
JSS Journal of Statistical Software June 2014, Volume 58, Issue 1. http://www.jstatsoft.org/ Flexible Generation of E-Learning Exams in R: Moodle Quizzes, OLAT Assessments, and Beyond Achim Zeileis Nikolaus Umlauf Friedrich Leisch Universit¨at Innsbruck Universit¨at Innsbruck Universit¨at fur¨ Bodenkultur Wien Abstract The capabilities of the package exams for automatic generation of (statistical) exams in R are extended by adding support for learning management systems: As in earlier versions of the package exam generation is still based on separate Sweave files for each exercise { but rather than just producing different types of PDF output files, the package can now render the same exercises into a wide variety of output formats. These include HTML (with various options for displaying mathematical content) and XML specifications for online exams in learning management systems such as Moodle or OLAT. This flexibility is accomplished by a new modular and extensible design of the package that allows for reading all weaved exercises into R and managing associated supplementary files (such as graphics or data files). The manuscript discusses the readily available user interfaces, the design of the underlying infrastructure, and how new functionality can be built on top of the existing tools. Keywords: exams, e-learning, multiple choice, arithmetic problems, Sweave, R,LATEX, HTML, XML, IMS QTI, Moodle, OLAT. 1. Introduction The design for version 1 of the exams package was conceived eight years ago (in 2006) when the original authors (Grun¨ and Zeileis 2009) were involved in a redesign of the introductory statistics lecture at WU Wirtschaftsuniversit¨at Wien. Back then the main goal was to be able to produce exams along with associated self-study materials as PDF (portable document format) files. Thus, the main focus was still on printable materials for classic classroom exams. Although e-learning systems started to become available more easily back at that time, they were still not very widely used and, more importantly, rather few easy-to-use standards for specifying e-learning exams were available (e.g., WU Wien used a partially self-developed 2 Flexible Generation of E-Learning Exams in R e-learning system based on .LRN, see Blesius et al. 2007). However, since 2006 the situation has clearly changed: E-learning systems are now abundant with many universities offering one (ore more) e-learning system(s) in which all students are readily registered. Consequently, many lecturers routinely offer online exams (or tests, quizzes, assessments) for large-lecture courses { either as self-study materials or as (part of) the main assessment of the course. Among the more popular choices of learning management systems are the open-source systems Moodle { developed by Dougiamas et al. (2014) and supported by a large world-wide user community { or OLAT (for online learning and training) { originally developed by Universit¨at Zurich¨ (2012) and with the recent fork OpenOLAT being developed by frentix GmbH(2014) and a support community. A popular proprietary learning management system is Blackboard developed by Blackboard Inc.(2010). Standards for specifying and exchanging e-learning exams/assessements have also emerged (see Agea et al. 2009, for an overview). While Moodle specifies its own Moodle XML format (but can import and export several other formats), OLAT/OpenOLAT and Blackboard employ certain subsets of the international QTI (ques- tion & test interoperability) standard, version 1.2, maintained by the IMS Global Learning Consortium, Inc.(2002). The successor formats are QTI 2.0 and the current QTI 2.1 which is for example employed in the ONYX testsuite (BPS Bildungsportal Sachsen GmbH 2014) that also offers interfaces to OLAT and Blackboard. Therefore, although the PDF exams produced by version 1 of the exams package as introduced by Grun¨ and Zeileis(2009) are still useful for many types of courses, it would also be highly desirable to have support for generating e-learning exams from the same pool of exercises. In fact, this became an apparent need when the authors of the present manuscript took over new large-lecture statistics and mathematics courses at their respective institutions (Univer- sit¨at Innsbruck and Universit¨at fur¨ Bodenkultur Wien, BOKU, respectively). For example, the new \Mathematics 101" lecture at Universit¨at Innsbruck is currently attended by about 1,600 students (mostly first-year business and economics students) and accompanied by bi- weekly online exams conducted in the university's OLAT learning management system. This was a strong incentive to start developing version 2 of the exams package that is presented here and offers an extensible toolbox for generating e-learning exams, including easy-to-use functions for Moodle quizzes and OLAT assessments1. The new version of the exams package for the R system for statistical computing (R Core Team 2014) is available from the Comprehensive R Archive Network at http://CRAN.R-project. org/package=exams. Like prior versions it employs ideas and technologies from literate pro- gramming and reproducible research (see e.g., Knuth 1992; de Leeuw 2001; Leisch and Rossini 2003; Kuhn 2014) by using Sweave() (Leisch 2002) to combine data-generating processes in R with corresponding questions/solutions in LATEX(Knuth 1984; Lamport 1994). But in ad- dition to producing exams in PDF format, the new version of exams includes extensible tools for generating other output formats without having to modify the pool of exercises. Thus, the design principles of the exams package are only somewhat extended compared to version 1: Each exercise template (also called \exercise" for short) is a single Sweave file (.Rnw) interweaving R code for data generation and LATEX code for describing question and solution (possibly containing mathematical notation in LATEX). 1Currently, OLAT and OpenOLAT do not differ with respect to their specification of exams. Hence, essen- tially all discussion of OLAT in this manuscript applies to both OLAT and OpenOLAT. Journal of Statistical Software 3 Exams can be generated by randomly drawing different versions of exercises from a pool of such Sweave exercise templates. The resulting exams can be rendered into various formats including PDF, HTML, Moodle XML, or QTI 1.22 (for OLAT/OpenOLAT). Maintenance is simple as exercises are separate standalone files. Thus, large teams can work jointly on the pool of exercises in a multi-author and cross-platform setting because each team member can independently develop and edit a single exercise. The remainder of this paper consists of two major parts: First, we illustrate in Section2 how to use both the old and new exam-generating functions that are readily available in the package. This serves as a first introduction and is sufficient for getting a good overview of the available features and how to get started. Second, Section3 provides details about the design underlying the toolbox for the new infrastructure. This section { as well as the subsequent Section4 showing how to extend the toolbox { may be skipped upon first reading but it contains many details that are likely to be important when actually starting to create course materials with the package. Finally, a discussion in Section5 concludes the paper. 2. Using the exams package In this section we provide an overview of the most important user interfaces provided by the exams package. This serves as a first introduction, assuming only (basic) knowledge of Sweave (Leisch 2012a,b). First, the format of the exercise Sweave files is reviewed along with the old (version 1) exams() function. Subsequently, the new (version 2) functions of type exams2xyz() are introduced: exams2pdf() and exams2html() produce one PDF or HTML file for each exam, respectively. In case of just a single exam, this is shown interactively in a viewer/browser. exams2moodle() and exams2qti12() generate Moodle and QTI 1.2 exams, i.e., just a single XML or ZIP file, respectively, which can be easily uploaded into Moodle and OLAT. 2.1. Version 1: PDF exams() from Sweave exercises Exercise templates (or just \exercises" for short) are essentially separate standard Sweave files (Leisch 2012a,b). They are composed of the following elements: R code chunks (as usual within <<>>= and @) for random data generation. Question and solution descriptions contained in LATEX environments of corresponding names. Both can contain R code chunks again or include data via \Sexpr{}. Metainformation about the exercise type (numeric, multiple choice, . ), its correct solu- tion etc. All metainformation commands are in LATEX style but are actually commented out and hidden in the final output file. The underlying ideas are eplained in more detail by Grun¨ and Zeileis(2009) and Section3 provides more technical details. Here, we focus on illustrating how different output formats can be generated from such exercises. 2An implementation of the newer QTI 2.1 standard is also available in the package, see ?exams2qti21. However, at the time of writing the function still needs more thorough testing and is hence not discussed here. 4 Flexible Generation of E-Learning Exams in R <<echo=FALSE, results=hide>>= ## DATA GENERATION n <- sample(120:250, 1) mu <- sample(c(125, 200, 250, 500, 1000), 1) y <- rnorm(n, mean = mu * runif(1, min = 0.9, max = 1.1), sd = mu * runif(1, min = 0.02, max = 0.06)) ## QUESTION/ANSWER GENERATION Mean <- round(mean(y), digits = 1) Var <- round(var(y), digits = 2) tstat <- round((Mean - mu)/sqrt(Var/n), digits = 3) @ \begin{question} A machine fills milk into $\Sexpr{mu}$ml packages. It is suspected that the machine is not working correctly and that the amount of milk filled differs from the setpoint $\mu_0 = \Sexpr{mu}$. A sample of $\Sexpr{n}$ packages filled by the machine are collected. The sample mean $\bar{y}$ is equal to $\Sexpr{Mean}$ and the sample variance $s^2_{n-1}$ is equal to $\Sexpr{Var}$.