In 2014 I launched a new course, “Mathematical Foundations of Statistical Software,” in the Harvard Extension school, aimed at students with a solid background in calculus. Lectures were a mixture of proofs and R scripts, all homework was done in R, and students completed two major projects using R. Encouraged by the success of the course, I introduced R as a tool for doing linear algebra in the summer course: “Vectors: a Tool for Teaching Algebra, Geometry, and Trigonometry.” Use of R on the homework was limited to modifying scripts that had been presented in class. Again, the use of R was a success.
Last fall, in a large freshman course in linear algebra, real analysis, and multivariable calculus, I devoted about an hour per week to R scripts, without ever using a single statistical function. The interactive graphical capabilities of R permitted novel illustrations of concepts such as limits, eigenvectors, critical points, and vector fields. Extension students who cross-registered for the course liked the use of R, but the freshmen, when asked to suggest what could be done to improve the course, were almost unanimous in saying “Get rid of R!” The difference in the reaction of adult learners and freshmen, tested by doing a permutation test in R, is significant with a P-value of .01.
Boost Fertility New Invention Ups Success Rates.pdf
Adventures in using R to teach mathematics
1. Adventures in using R
to teach mathematics
Paul G. Bamberg
Senior Lecturer on
Mathematics
Harvard University
O P E N
D A T A
S C I E N C E
C O N F E R E N C E
BOSTON
2015
@opendatasci
2. Prologue – Data Science in the 1980s
• Given recordings of several thousand English
words and the phonetic spelling of each word,
build an acoustic model for each phoneme of
English in each possible phonetic context.
• Given electronic versions of several years of the
Boston Globe and other text, make a table of the
frequency of occurrence of all pairs of English
words.
• The result: DragonDictate for MS-DOS, with a
64,000 word vocabulary, running on an Intel
80286 processor.
3. Act I
• You can fool almost all of the people
almost all of the time.
• Bob Marley
• Mathematics E-156, Spring 2014
• Prerequisites
4. Why choose open-source software?
Misadventures with the alternative:
• Windows GUI programming
Microsoft Visual C++ 6
(taken off the market in favor of .NET)
• Linux GUI programming
Red Hat Linux
(versions for individual use discontinued)
• Computer algebra
Mathematica
(free, but only for enrolled undergraduates)
8. Midterm and Final Projects
• Analysis of Demographics and Socioeconomic Factors
of Countries
• Analysis of Gene Expression Data
• Analysis of Global and National Data on Public Health
Issues of Substance Abuse
• Analysis of IT Satisfaction Survey
• Experimental parameters in high-throughput gene
expression
• etc………
9. Was the course a success?
• Evaluation results
• “Very rigorous treatment of material. The R
scripting gave useful examples that can be
applied to real world problems.”
• “The use of the R Programming Language in
understanding key statistics concepts really
helped. Doing the homework manually (as
opposed to using the built-in methods) was
extremely helpful in my understanding of the
core concepts.”
10. Act II
• Summer School is Y-coming in
• National Youth choir
• Mathematics S-323,Harvard Summer School
• Course description
11. Use of R in Math S-323
• No statistical functions!
• No data frames!
• Much use of built-in vector operations
• Diagrams for geometry and trig.
• Inversion and row reduction of large matrices.
• Spherical geometry (fascinating, but
computationally messy if done by hand).
12. Scripts used during lecture
• Points and vectors
• Matrix for a Markov Process
• Theorem of Menelaus
13. R scripts in problems
• Students broke up into three teams of four to
solve these problems during class, then each
team uploaded its solution to the Web site.
• Three problems from day 2
• Solution to problem 3
• Solution to a problem on the midterm
14. Was a math course with R
OK for high-school math teachers?
• Summer School evaluations
15. Act 3
• What is sauce for the goose may not be sauce
for the gander.
Math 23a/E-23a, Fall 2014
• Irish Chieftains
16. If Harvard freshman math
were football instead…
• Math 55a = All-Americans
• Math 25a = Starters on the varsity
• Math 21a = Intramural sports
• Math 18 and 19 = Just spectators
17. A week of Math 23a materials
• Samples from Week 4
18. Perhaps R will go viral on YouTube
• Introductory script on eigenvectors
19. Using R to present a proof
• Georg Cantor's proof that the real numbers
between 0 and 1 are an uncountably infinite
set
20. Using R to do real analysis
• The Bolzano-Weierstrass theorem: on a closed
interval, every infinite sequence of real
numbers has a convergent subsequence.
21. Using R to explain divergence and curl
• Derivative of a vector field
22. Was a math course with R
OK for Extension students?
• Math E-23a evaluations
23. Was a math course with R
OK for Harvard freshmen?
• My worst evaluations in 15 years
24. Is the difference in evaluations
between adult learners and freshmen
statistically significant?
Permutation test on the data
Conclusion: the probability that such a large
difference between Extension and freshman
evaluation scores would arise by chance is less
than 1%.
25. How could this course be improved?
• Less use of R would facilitate better understanding of the material.
• The R-scripts, while beautiful and illustrative, were not extremely helpful .
• Get rid of R for lecture.
• Maybe less use of the R studio. Many students don't like using R.
• I think this course might be improved by relying way more on pencil and
paper to explain material than by relying on R.
• R was a good addition to the course (esp. on homework) ... but too much
lecture time was spent on it.
• The use of the programming language R is superfluous and hinders
understanding of the material.
• The R coding element is great for demonstrations, but is tedious when on
problem sets.
• etc…… The message is clear.
26. One Extension student’s interpretation
• “Most students in this class were freshmen and
their entire experience with math is stuff they can
do by hand. They want to just know how to do it
and then solve the problem and get an answer.
But I can't think of a single job the students
would have in the future where they'd be doing
math by hand. You absolutely need to know how
math can be done through programming to solve
hard problems. Those are super marketable skills
-- row reducing by hand is not. I certainly didn't
know or appreciate this as an 18 year old. I do
now.”
27. Act 4
• Did I throw out the baby with the bathwater?
• Math 23b/E-23b, Spring 2015
• Eddie Burns
28. Clap if you want to save Tinker Bell
• Email to the class: no R scripts during lecture
in Math 23b.
• I emailed all the students who had done term
projects in R to let me know if I should make
YouTube videos of R scripts for Math 23b and
if they wanted optional homework problems
and term projects using R. Only a handful
replied.
29. A survey with a 100% response rate
• For 1 point on the final exam: what did you like better in the fall
than in the spring?
• “R was an opportunity to visualize concepts.”
• “I thought the use of R was quite effective in the fall term.”
• “Learning R to do the problem sets was a useful skill and I wish I’d
done more of it.”
• “Extra credit R project was good. R for extra credit is ideal.”
• “Using R with concepts of real analysis helped me visualize limits
better.”
• “Concepts were made clear through the use of R for in-class
demonstrations, particularly those in need of heavy computation. R
also allowed application examples to be done in lecture.”
30. Spring term evaluations
• Freshmen: up by 0.4
• Extension: up by 0.2
• Under “strengths of the course:”
• “No R scripts.”
• “I’m so glad there was no R.”
• “Not using R made Math 23 so much better.
31. Tentative conclusions
• With students who know they are going to be using R
professionally, lectures based on R scripts are
effective and well received.
• Non-programmers like R for visualization and
eliminating tedious computation, but explaining
scripts line-by-line is a no-no.
• For presenting R scripts, YouTube is as effective as a
live lecture.
• Homework problems that only require modifying
existing R scripts can be done by anyone.
32. You can do this next year
• Math E-23a and Math E-23b will be offered again,
and for the first time there is an online-only
option. R is used only for linear algebra.
• Math S-323 starts on June 20.
• I am looking for a statistician with teaching
experience to take over Math E-156. Email a
resume to bamberg@tiac.net if interested. If no
one applies, I will probably teach the course
myself Wednesdays 5:30-7:30 in the spring.
• Harvard Extension School offers a graduate
certificate in data science.