/UC-Berkeley-STAT133

Warmups, labs, and workout projects in course STAT 133 at UC Berkeley

Primary LanguageHTML

Stat 133, Spring 2019

Private Repository for HW assignments of Stat 133 (Spring 2019)


Workout Projects

  • Workout 1: NBA Performance Analysis
    This R written project is mainly about the data analysis cycle of NBA GSW data. In the data preparation stage, I downloaded data, cleaned data by manipulating them, and merged files for further analysis. In the core analysis stage, I wrote code to make statistical summaries of different players' performances, plotted graphs to display their shots and changed the formats of the graphs to enable them to be shown in the final report. In the reporting stage, I wrote an Rmd file to display the analyzing process and results to readers. My final report includes the following parts - introduction, motivation, background, data, analysis, discussion, conclusion, and references.

  • Workout 2: Investment Shiny App
    In this project, I created a Shiny App that allows users to visualize - in an interactive way - some of the saving/investing scenatios. There are three modes of investing: no contribution after principal, fixed annual contribution, and growing annual contribution. When users open this Shiny App, they can drag the dot on each bar to customize parameters, such as "Initial Amount", "Return Rate", "Years", "Annual Contribution", "Growth Rate", and whether they want a faceted display or not. Then the App automatically calculates the total account balance each year under the three investing modes. It also graphs the balances with time to give users a visual understanding of the growing trends.

  • Workout 3: R Package "binomial"
    I created an R package called "binomial" that provides functions to check whether the inputs are valid, to calculate the probability based on given parameters, to graph the distribution and to display a summary of expected value, variance, skewness, kurtosis, etc.


Warmup Homework


Labs

Lab 1: R and RStudio

Get started with R as a scientific calculator
Understand pane layout of RStudio
Understand the help documentation in R
How to install packages
Difference between .R and .Rmd files
Get to know markdown syntax

Lab 2: Vectors

Work with vectors of different data types
Understand the concept of atomic structures
Learn how to subset and slice R vectors
Understand the concept of vectorization
Understand recycling rules in R

Lab 3: Data Frame Basics

Importing Data Tables in R
Default reading-table functions
Basic manipulation of data frames

Lab 4: dplyr and ggplot2

Get started with "dplyr"
Get to know the basic dplyr verbs:
slice(), filter(), select()
mutate()
arrange()
summarise()
group_by()
Get started with "ggplot2"
Produce basic plots with ggplot()

Lab 5: Command Line Basics

Practicing with the command line
Navigating the filesystem and managing files
Practice basic manipulation of data files
Practice exporting tables from R
Practice exporting displayed output (as is) from R
Practice exporting plot images from R

Lab 6: Git and GitHub Basics

Create a GitHub repository
Create a local Git repository
Practice adding, and committing changes to your (local) Git repo
Practice pushing committed changes to a remote repo

Lab 7: Simple Functions and Conditionals

Learn how to write simple functions
Get into the habit of writing simple functions
Get into the habit of documenting functions
Make sure your functions work
Use conditionals if-then-else

Lab 8: Simple Loops

Forget about vectorized code (pretend it doesn’t exist)
Practice writing simple loops
Get familiar with the syntax of a for loop
Get familiar with the syntax of a while loop
Get familiar with the syntax of a repeat loop
Encapsulate loops inside a function call

Lab 9: Testing Functions and String Basics

Introduction to the R package “testthat”
Write simple functions and their unit tests
Test your code
String manipulation
Base R functions for strings

Lab 10: Random Numbers and Simulations

getting started with simulations in R
learn how to create a basic shiny app
put in practice concepts from your introductory statistics course(s)

Lab 11: Regular Expressions

Work with the package "stringr"
String manipulation
More regular expressions
A bit of data cleaning

Lab 12: Web Scrapping

Work with the package "rvest"
Learn to extract html elements and attributes
Create a simple crawler