R midterms

Here are my R midterm exams, version A and version B in English (as students are sitting next to one another in the computer rooms), on simulation methods for my undergrad exploratory statistics course. Nothing particularly exciting or innovative! Dedicated ‘Og‘s readers may spot a few Le Monde puzzles in the lot…

Two rather entertaining if mundane occurences related to this R exam: one hour prior to the exam, a student came to my office to beg for being allowed to take the solution manual with her (as those midterm exercises are actually picked from an exercise booklet, some students cooperated towards producing a complete solution manual and this within a week!), kind of missing the main point of having an exam. (I have not seen yet this manual but I’d be quite interested in checking the code they produced on that occasion…) During the exam, another student asked me what was the R command to turn any density into a random generator: he had written a density function called mydens and could not fathom why rmydens(n) was not working. The same student later called me as his computer was “stuck”: he was not aware that a “+” prompt on the command line meant R was waiting for him to complete the command… A less comical event that ended well is that a student failed to save her R code (periodically and) at the end of the exam and we had to dig very deep into the machine to salvage her R commands from \tmp as rkward safeguards, as only the .RData file was available at first. I am glad we found this before turning the machine off, otherwise it would have been lost.

10 Responses to “R midterms”

  1. 6/pi^2 is the asymptotic density of the set **square-free** numbers,
    not its complementary (“numbers divisible by perfect squares”). See
    http://en.wikipedia.org/wiki/Square-free_integer for an heuristic

  2. This seems quite difficult for a 4th course in statistics and probability! Especially difficult given the distribution of knowledge and ability I infer from the lower end anecdotes you tell above! Bunch of fun problems though!

    • Our students are taking measure theory in parallel to this course, plus optimisation and functional analysis courses, so this is the “easy” one in the series. Plus, they had several weeks to practice on the exercise booklet, knowing the exam would come from those. Obviously, some did not practice….

  3. Just out of interest, on the lottery ticket problem, did anyone go this route:
    foo<- gsub('[2,4,5,6,7,8,9,0]','',foo) only 1s and 3s left
    #find positive diffs in foo

    • thanks, this sounds too clever by half for our beginners, however I have not received their code file from the computing department so who knows?!

  4. Exercise 3, #5: rly? I hope the students saw this as “prove A=(B+A)/2 ” and quickly observed the symmetry in the exponent. :-)

  5. William Volterman Says:

    The definition of a pareto CDF for negative a seems to be incorrect. It should be

    F(x) = 1 if x >= a
    F(x) = (x/a)^k if x < a

    Furthermore, you can't take a in R, as a = 0 is not well defined (Though I suppose you could make it a point mass at 0.)

  6. I am sure your students gained much experience thanks to your teaching. Well done!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: