1/78
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress

Statistics Definition
The study of variation ā how to measure it, how to model it.
Data Generating Process (DGP)
The hidden, real-world mechanism that produces the data we observe, We never see the true DGP; we use data samples to infer how it works.
Population
The entire group you want to draw conclusions about
Sample
The specific subset of the population from which you collect data.
tally ()
Used to count frequencies and proportions of categorical data.
head ()
Shows the first 6 rows of a data frame to check its structure.
str()
Displays the internal structure of a data frame: data types, number of rows/columns
Tidy Data Structure
A strict data layout where each row = single case/observation, each column = a single variable, and each cell = a single value
Quantitative Variables
Numerical values where mathematical operations make sense
Qualitative (Categorical) Variables
Labels or categories
Quantitative variable R Type
int, num
Categorical data R Type
Factor, chr
as.factpr()
R function used to explicitly convert a quantitative/character variable into a categorical factor
Distribution
How often the different values of a variable occur in a dataset
gf_histogram()
Groups continuous data into equal-width "binsā
gf_densitiy ()
Creates a smooth curve showing where data points are most concentrated
gf_bar()
Bar charts used for counting distinct categories
Modality
the number of peaks
Unimodal
one peak
Bimodal
two peaks
Uniform
flat
Skewness
the direction of the long tail
right-skewed (positive)
the tail stretching out to the right (higher values. The mean id typically pulled higher than the median.
Left-skewed (negative)
The tail stretches out to the left (lower values), The mean is typically pulled lower than the median
Symmetry
Mirror-image apparence on both sides of the center
faceting
using gf_facet_grid(Outcome ~ Predictor) to split a single plot into multiple panels based on a categorical grouping variable
Explaining vs. Describing
Moving from looking at one variable (univariate to looking at the relaitonship between two variables (bivariate)
Outcome Variable (Y)
The dependent variable; the thing you are trying to predict or explain (plotted on the y-axis
Explanatory Variable (X)
The independent variable; the thing that you suspect causes or predicts changesin the outcome (plotted on the x-axis)
Observational Studies
Reseachers observe variables without intervening. The studies can show correlation/association, but cannot prove causation due ot confounding variables
confounding variables
variables that influence both X and Y
Experimental Studies
Researchers actively manipulate the explanatory variable
Random Assignment
It distributes confounding variables equally across treatment groups, isolating X as the sole cause of changes in Y, allowing for causal conclusions.
Induced Variation
Variation created intentionally by a researcherās experimental manipulation
Error/Real-World Variation
Natural difference among individuals, or measurement errors
Statisitical Model Definition
A simpliflied mathematical representation of the Data Generating Process
The empty Model Equation
Yi = b0 + ei
Why is the empty model empty?
contains zero explanatory variables
The Mean as the Ultimate Empty Model
For quantitative
What does the sum of all deviations of all data points from the mean equal?
Zero
Deviation
Distance
What does the mean do for the data?
Balances it
What does the mean do to the sum of squared deviations
minimises the SS deviations
R-code for fitting the empty model
lm(Outcome ~ NULL, data = Dataset)
Residuals
The mathematical definition for error for an individual case
Residuals equation
ei = Yi - Y-bar
Data point above the modelās prediction
residual = positive
Data point below the prediction
Residual = negative
Sum of Squares
SS = Sum(Yi-Y-bar)²
What does SS quantify?
total amount of error
Degrees of Freedom (df)
The number of indepdent pieces of information that went into calculating a statistic
Degree of freedom for the empty model
n - 1, n = sample size
Variance (s²)
The mean squared error ā- quantifies the average squared distance from the model
Variance (s²) Equation
s² = SS/df = Sum(Yi-Y-bar)²/n-1
Standard Deviation (s)
The square root of variance
Standard Deviation Equation
s = Sqrt of s²
Standard Deviation Equation Purpose
Takes the square root of the variance unit and puts it into the original units of the data. This then tells us the typical distance a data point falls from the mean
Z-Scores (Standardized Scores)
Measures how many standard deviations a specific data point is away from the mean
Z-Score EQ
z = Yi-Y-bar/s
z-score exactly at the mean equals?
zero
Purpose of z-score
allows you to compare values from completely different distributions
Empirical Rule (ā68-95-99.7)
In a bell-shaped distribution: ~68% of observations fall within ± 1 standard deviation of the mean; ~96% of observations fall within ± 2 standard deviations of the mean;and ~99.7% of observations fall within +/_ 3 standard deviations of the mean
Extracts the individual error values (ei) for every row
reside(EmptyModel)
Shows the predicted value (Y-bar) for each row
predict(EmptyModel)
Gives the area under the normal curve to the left of a given z-score (percentile)
pnorm(z-score)
The inverse of pnorm. Input a percentile/probability and it returns the corresponding z-score
qnorm(probability)
Visualizations for Quantitative variables
Histogram, Boxplot
VIsualizations for Categorical Variables
Frequency tables, Bar chart
Qualitative outcome variable visualizations
jitter plot, Boxplot, faceted histogram
Quantitaive outcome variable visualizations
scatterplot, faceted hsitogram
The select command ā subsets columns
select(dataframe, column1, column2ā¦). Returns a data frame that contains the columns that you specified as arguments.
The filter command ā subsets rows
filter(dataframe, criteria). Returns a data frame that contains the rows that fit your criteria
Understand structure of data
str(dataframe)
R-code for arranging dataframe based on a specific variable, in descending order
datafram$variable
R-code for going from lowest to highest in a list
arrange(dataframe, (desc(variable))
R-code for going from highest to lowest in a list
arrange(dataframe, variable)
R-code for listing numbersā frequency and numbers in order from lowest to highest
tally(dataframe$variable) or tally(~variable, data = dataframe)
R-code for displaying the last 6 rows
tail(dataframe)
R-Code for displaying the first 6 rows
head(dataframe)