install.packages("tidyverse")
2 Overview
2.1 Presentation Outline
Self introduction
The syllabus
Goal of this class
Delivery method of class materials
Assignments
Policy
Weekly schedule
Brief introduction to statistical software
2.2 Self Introduction
2.3 My job
2.4 Your turn
Tell me:
- Your name
- Department name
- Which year in your program
- Why you are interested in Experimental design
2.5 About this class
No examination
Light homeworks, 3-5 assignments with multiple-choice questions and light calculations
To teach big picture and general directions rather than statistical details
A lot of examples
All materials use R!
2.6 This Course is:
- Required for Graduate Certificate in Educational Statistics and Research Methods
- Prerequisite to Multiple Regression and Applied Multivariate Statistics
- to provide the broad picture of one of the most popular research design - group comparisons
2.7 Learning Path of Graduate Certificate
2.7.1 Statistics Learning Path:
- ESRM 64003 — Educational Statistics and Data Processing: Establish fundamental statistical skills.
- ESRM 64103 — Experimental Design: Learn research design methodologies.
- ESRM 64203 — Multiple Regression: Explore complex relationships between variables.
- Elective: ESRM 64503 — Applied Multivariate Statistics: Extend analysis to multiple dependent and independent variables.
- Elective: ESRM 65203 — Structural Equation Modeling: Develop expertise in complex model testing.
2.7.2 Measurement Learning Path:
- ESRM 64003 — Educational Statistics and Data Processing: Gain foundational knowledge in statistics.
- ESRM 64103 — Experimental Design: Acquire skills in designing educational research.
- ESRM 64203 — Multiple Regression: Understand the influence of multiple predictors.
- Elective: ESRM 66503 — Measurement and Evaluation: Focus on assessment and evaluation techniques.
- Elective: ESRM 67503 — Item Response Theory: Specialize in modern test theory applications.
2.8 Class Time
- Unit 1 (17:00 - 17:45): Lectures about concepts
- Unit 2 (18:00 - 18:45): Examples
- Unit 3 (19:00 - 19:45): Self Practice with R Code on your laptop and Ask Questions
2.9 What To Expect This Semester
Philosophy: Focus on accessibility + learning-by-doing
The AMS class heavily emphasize on hands-on task-oriented practices
No anxiety-prone tasks (e.g., hand calculations, memorizing formulas)
No anxiety-prone methods of evaluation (e.g., timed tests)
Materials:
Lecture slides present concepts—the what and the why
Example documents: reinforce the concepts and demonstrate the how using software—R packages
All available at the course website (hosted outside of Blackboard)
- Let me can show you how to use the website
2.10 Assignments and Grading
Participants will have the opportunity to earn up to 100 total points in this course.
Up to 88 points can be earned from homework assignment (3~6 assignments in total)
Up to 12 points may be earned from submitting in-class quiz. In-class quiz will be delivered randomly in class. These will be graded on effort only—incorrect answers will not be penalized.
Bonus points (10 points)
- There may be other opportunities to earn extra credit at the instructor’s discretion.
Late Assignment:
- Assignments submitted any time after the deadline will incur a 1-point penalty. However, extensions will be granted as needed for extenuating circumstances (e.g., conferences, comprehensive exams, family obligations) if requested at least two weeks in advance of the due date.
2.11 Homework delivery
- Online Microsoft form or Word document via Email
- https://www.menti.com/alu3mgbzvd6g
2.12 Our Other Responsibility
My job (besides providing materials and assignments):
Answer questions via email, in individual meetings, or in group-based zoom office hours—you can each work on homework during office hours and get immediate assistance (and then keep working)
- Email me first
Your job (in descending order of timely importance):
Ask questions—preferably in class, but any time is better than none
Frequently review the class material, focusing on mastering the vocabulary, logic, and procedural skills
Don’t wait until the last minute to start homework, and don’t be afraid to ask for help if you get stuck on one thing for more than 15 minutes
- Please email me (jzhang@uark.edu) a screenshot of your code+error so I can respond easily
Practice using the software to implement the techniques you are learning on data you care about
Do the readings for a broader perspective and additional example (best after the lecture)
2.13 More About Your Experience in this Class
Attendance: Strongly recommended but not required
Please do not attend in-person if you might be sick!
Please do not attend if you received the inclement weather notification
You can also join the class via Zoom
You won’t miss out: I will post YouTube recordings (audio + screen share) by requested at the course website.
Changes will be sent via email by 9 am on class days
I will update the homework and in-class quiz links on class days. If not uploaded, then there are two situations: (1) I forget to do that. I will re-upload later and notify you by emails. (2) I decide not to upload it or remove it.
I may change to zoom-only for dangerous weather or if I am sick.
2.14 Statistical Software
I will show examples primarily using R and R packages. Some important R packages include:
Tidyverse: a comprehensive R package including multiple mini packages for multiple data cleaning, data transformation.
ggplot2: a popular package for data visualization
Why not SPSS?
SPSS could only be used for some—but not all–of our content
More importantly, it doesn’t have as much room to grow; R has many new packages being developed via CRAN and GitHub
Why not SAS?
SAS is not open-sourced, meaning that we cannot check source code if something goes wrong
SAS is also commercial, but R is free
2.15 What We Will Cover
- Hypothesis Testing
- ANOVA
- One-way
- Two-way
- Repeated-measure
- ANCOVA
- Linear Mixed Model
3 Unit 2: Brief Introduction to R
3.1 Why R?
There are some point to consider
R packages are only as good as their authors (so little quality control)
Syntax and capabilities are idiosyncratic to the packages
The good things are:
If you really master R, you can do by yourself (write your own algorithm for complex model)
You can check the source code of R packages and know where issues come from
You can communicate with R package authors and provide some suggestions
You can be R package author yourself and be famous
3.2 What is R
R is an comprehensive statistical and graphical programming language
We can use R language via multiple graphical user inferences or IDE, i.e., terminal, VS Code or RStudio.
We will mainly focus on RStudio because of its convenience
Rstudio is a product of posit company and is free to use for personal use
3.3 More RStudio
3.4 Installation of R and RStudio
You can download and install R base via r-project.org (currently R-4.4.1)
Then, after the installation of R, you can download RStudio via posit.co (currently)
After installation of R and RStudio, you can open up the RStudio to start your R programming.
however, your R only has the base package
To enhance its utility, most users will install R packages for certain purposes
3.5 R packages
R packages are uploaded to some platforms (i.e., CRAN or Github) by researchers or companies
Those R packages typically have their version numbers. Some functions may be available for some version (like Ver. 1.1) but not be available in other versions.
Do not upgrade your packages if you code is running well
R users are free to download and use those R packages
To download certain package, you should know package name
For example, if you want to download the latest version of
tidyverse
package, you can type in following command in the console panel of Rstudio
- Or if you want to install the older version of package
require(devtools) install_version("tidyverse", version = "1.3.0", repos = "http://cran.us.r-project.org")
3.6 More about R packages
- CRAN (Comprehensive R Archive Network) is a network of servers around the world that store identical, up-to-date, versions of code and documentation for R.
- It contains most stable version of packages.
- Most of time, we download package from CRAN
- Github is for the fast development for R packages
It contains the up-to-date version of R which may potentially be unstable
You can download the package from Github using
pak
package::pak("tidyverse/ggplot2") pak
You can update the package and its dependencies
::pkg_install("ggplot2", upgrade = TRUE) pak
3.7 R functions
To operate certain tasks, you need to use functions contained in R packages
3.8 R functions (Cont.)
How do you know you already load the package or not
You can use
sessionInfo
functionsessionInfo()
R version 4.4.2 (2024-10-31) Platform: aarch64-apple-darwin20 Running under: macOS Sequoia 15.3.1 Matrix products: default BLAS: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRblas.0.dylib LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.0 locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 time zone: America/Chicago tzcode source: internal attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] htmlwidgets_1.6.4 compiler_4.4.2 fastmap_1.2.0 cli_3.6.3 [5] tools_4.4.2 htmltools_0.5.8.1 parallel_4.4.2 rstudioapi_0.17.1 [9] yaml_2.3.10 rmarkdown_2.29 knitr_1.49 jsonlite_1.8.9 [13] xfun_0.51 digest_0.6.37 rlang_1.1.5 evaluate_1.0.3
It outputs multiple info:
R version, Operations System, Matrix operation package, Locale
Attached packages (you can call the functions of those package)
Loaded package via a namespace (and not attached), which you cannot call functions and need to
library
orrequire
them
3.9 Run R code
After you finish R script, you have multiple ways of running the code:
Method 1: you can click
Run
button in the top right-head of RstudioMethod 2: you can select certain code and press
Ctrl + Enter
(Win) orCommand + Return
(Mac)Method 3: you can
Rscript [FILENAME].r
to run the whole scriptMethod 4: you can using R notebook to interactively run R code
Script file is .R | Script file is .rmd or .qmd | |
---|---|---|
Run the whole script |
|
|
Run the partial script |
|
|
3.10 Exercise 01: Make friends with R
- Open up Example01 - MakeFriendsWithR
3.11 Summary
- Note that the syllabus, schedule, and all materials are uploaded online the week before class.
- We learn that R, Rstudio, and Quarto (.qmd) can be used to execute R code/syntax.
- In-class quiz will be administered randomly. Should be quick and easy. Don’t be stressful ever!
- Office hour will be 2PM - 4PM on Monday. Feel free to stop by my office and ask questions.
- Next week, we will start to learn some basics about Experimental Design