teaching introductory statistics with r...
TRANSCRIPT
Teaching Introductory Statistics with RDiscussion
Alison L. [email protected]
Department of Statistical SciencesUniversity of Toronto
SSC 2014
Gibbs Intro Stats with R SSC 2014 1 / 16
Choices...
Menu-driven
Minitab
StatCrunch
SPSS
. . .
Command-driven
SAS
Matlab
R
. . .
1 Which do you use?
2 Which do you expect that users from other disciplines or industry willuse?
3 Which do you think are useful for your students?
Gibbs Intro Stats with R SSC 2014 2 / 16
Choices...
Menu-driven
Minitab
StatCrunch
SPSS
. . .
Command-driven
SAS
Matlab
R
. . .
1 Which do you use?
2 Which do you expect that users from other disciplines or industry willuse?
3 Which do you think are useful for your students?
Gibbs Intro Stats with R SSC 2014 2 / 16
Choices...
Menu-driven
Minitab
StatCrunch
SPSS
. . .
Command-driven
SAS
Matlab
R
. . .
1 Which do you use?
2 Which do you expect that users from other disciplines or industry willuse?
3 Which do you think are useful for your students?
Gibbs Intro Stats with R SSC 2014 2 / 16
Choices...
Menu-driven
Minitab
StatCrunch
SPSS
. . .
Command-driven
SAS
Matlab
R
. . .
1 Which do you use?
2 Which do you expect that users from other disciplines or industry willuse?
3 Which do you think are useful for your students?
Gibbs Intro Stats with R SSC 2014 2 / 16
R for statistics novices
It can be done!
Joel’s class: distance-education, professional Masters
Kevin’s class: MPH epidemiology program (with undergraduatecourse in statistics)
Could it also work for junior undergraduates?
An email from a colleague in biology
Hi Alison,I wanted to enquire whether you might know if Stats is considering changing to Rin the intro course... I have found that our undergrad research students withsome experience with R seem much more capable to jump into analysis of theirown project data, and I suspect that other disciplines also frequently use R. Idon’t know what your position might be on this issue, but I know from theperspective of biology that it would be really helpful if students learned R as apractical element of their intro stats training.
Gibbs Intro Stats with R SSC 2014 3 / 16
R for statistics novices
It can be done!
Joel’s class: distance-education, professional Masters
Kevin’s class: MPH epidemiology program (with undergraduatecourse in statistics)
Could it also work for junior undergraduates?
An email from a colleague in biology
Hi Alison,I wanted to enquire whether you might know if Stats is considering changing to Rin the intro course... I have found that our undergrad research students withsome experience with R seem much more capable to jump into analysis of theirown project data, and I suspect that other disciplines also frequently use R. Idon’t know what your position might be on this issue, but I know from theperspective of biology that it would be really helpful if students learned R as apractical element of their intro stats training.
Gibbs Intro Stats with R SSC 2014 3 / 16
R for statistics novices
It can be done!
Joel’s class: distance-education, professional Masters
Kevin’s class: MPH epidemiology program (with undergraduatecourse in statistics)
Could it also work for junior undergraduates?
An email from a colleague in biology
Hi Alison,I wanted to enquire whether you might know if Stats is considering changing to Rin the intro course... I have found that our undergrad research students withsome experience with R seem much more capable to jump into analysis of theirown project data, and I suspect that other disciplines also frequently use R. Idon’t know what your position might be on this issue, but I know from theperspective of biology that it would be really helpful if students learned R as apractical element of their intro stats training.
Gibbs Intro Stats with R SSC 2014 3 / 16
R for statistics novices
It can be done!
Joel’s class: distance-education, professional Masters
Kevin’s class: MPH epidemiology program (with undergraduatecourse in statistics)
Could it also work for junior undergraduates?
An email from a colleague in biology
Hi Alison,I wanted to enquire whether you might know if Stats is considering changing to Rin the intro course... I have found that our undergrad research students withsome experience with R seem much more capable to jump into analysis of theirown project data, and I suspect that other disciplines also frequently use R. Idon’t know what your position might be on this issue, but I know from theperspective of biology that it would be really helpful if students learned R as apractical element of their intro stats training.
Gibbs Intro Stats with R SSC 2014 3 / 16
“Are we crazy?”
hist {graphics} R Documentation
Histograms
Description
The generic function hist computes a histogram of the given data values. If plot =TRUE, the resulting object of class "histogram" is plotted by plot.histogram, before itis returned.
Usage
hist(x, ...)
## Default S3 method:hist(x, breaks = "Sturges", freq = NULL, probability = !freq, include.lowest = TRUE, right = TRUE, density = NULL, angle = 45, col = NULL, border = NULL, main = paste("Histogram of" , xname), xlim = range(breaks), ylim = NULL, xlab = xname, ylab, axes = TRUE, plot = TRUE, labels = FALSE, nclass = NULL, warn.unused = TRUE, ...)
Arguments
x a vector of values for which the histogram is desired.breaks one of:
a vector giving the breakpoints between histogram cells,
a function to compute the vector of breakpoints,
a single number giving the number of cells for the histogram,
a character string naming an algorithm to compute the numberof cells (see ‘Details’),
a function to compute the number of cells.
In the last three cases the number is a suggestion only; thebreakpoints will be set to pretty values. If breaks is a function, the xvector is supplied to it as the only argument.
Gibbs Intro Stats with R SSC 2014 4 / 16
Could R be the right choice for my introductory course?
Yes! If you want it to be.
Your students won’t outgrow it.
There are tools to make it easier for novices.
Gibbs Intro Stats with R SSC 2014 5 / 16
Could R be the right choice for my introductory course?
Yes! If you want it to be.
Your students won’t outgrow it.
There are tools to make it easier for novices.
Gibbs Intro Stats with R SSC 2014 5 / 16
Could R be the right choice for my introductory course?
Yes! If you want it to be.
Your students won’t outgrow it.
There are tools to make it easier for novices.
Gibbs Intro Stats with R SSC 2014 5 / 16
Adding training wheelsInstead of ....
Step1: Use R Studio (Integrated Development Environment or R commandergiving students pre-loaded with data
Gibbs Intro Stats with R SSC 2014 6 / 16
Adding training wheelsOr ....?
Step 1: Use R Studio (Integrated Development Environment or Rcommander giving students pre-loaded with data
Gibbs Intro Stats with R SSC 2014 8 / 16
Adding training wheelsOr RStudio on a server with the data pre-loaded?
R Studio make R easier and more fun to use SAME ON ALL PLATFORMS
Gibbs Intro Stats with R SSC 2014 9 / 16
Training wheels plus a downhill push: The mosaic package
make it easier to learn R by minimizing and simplifying the coding
with consistent syntax for function calls�� ��what I want( �� ��Y ∼
�� ��X , data =�� ��my data
)only the essential functions
protect students from vectors and data frames (for now)
Gibbs Intro Stats with R SSC 2014 10 / 16
Promoting Reproducible Research with R Markdown
Data analysis is an iterative process.
Can we capture that in a way that is comprehensible to someone else?
And reproducible?
Easy to reproduce, update, share
Suggestion: Use R Markdown to integrate code, output, commentary
Text block
R chunk
Text block
R chunk
Knit together as text, code, and output, including plots.
Gibbs Intro Stats with R SSC 2014 13 / 16
Promoting Reproducible Research with R Markdown
Data analysis is an iterative process.
Can we capture that in a way that is comprehensible to someone else?
And reproducible?
Easy to reproduce, update, share
Suggestion: Use R Markdown to integrate code, output, commentary
Text block
R chunk
Text block
R chunk
Knit together as text, code, and output, including plots.
Gibbs Intro Stats with R SSC 2014 13 / 16
Promoting Reproducible Research with R Markdown
One of Kevin’s assignments: write up the analysis “like a standardscientific paper.”
Train them early with reproducibility in mind.
Joel’s challenge: how to assess the use of R.
Hand in a document integrating executable code, output, andcommentary.
Kevin noted the danger of having learning the package obscurelearning the statistics.
But maybe the package can help us capture the statistical process.
Gibbs Intro Stats with R SSC 2014 14 / 16
Promoting Reproducible Research with R Markdown
One of Kevin’s assignments: write up the analysis “like a standardscientific paper.”Train them early with reproducibility in mind.
Joel’s challenge: how to assess the use of R.Hand in a document integrating executable code, output, andcommentary.
Kevin noted the danger of having learning the package obscurelearning the statistics.But maybe the package can help us capture the statistical process.
Gibbs Intro Stats with R SSC 2014 14 / 16
R for all ages
http://www.stats.uwo.ca/faculty/braun/RTricks/RTrixApps.php
Gibbs Intro Stats with R SSC 2014 15 / 16