1/108
Looks like no tags are added yet.
Before performing a statistical test, all statistical inquiries follow the same steps
1. Define parameter(s) and question
2. State null and alternative hypothesis
3. Check statistical assumptions
4. Choose significance level
5. Run test and compute test statistic
6. Compare Test Statistic and Critical Value
Define parameter(s) and question
1) What specific, measurable question are you asking?
2) Identify the population parameter(s) of interest
• Mean
• Proportion
• Difference
• Regression Coefficient
• Etc.
State null and alternative hypothesis
H0: Typically, there are NO differences between parameters of interest
Ha: There IS a difference between parameters of interest
Check statistical assumptions
Does our collected data conform to the assumptions of the modeling approach?
• Independent samples
• Random Sampling
• Equal chance of individuals being selected
• No pseudoreplication
Can we use parametric statistics?
• Are our data normally distributed? (Shapiro-Wilk Test)
• Are the variances in our data homogenous? (Levene’s Test)
Choose significance level
Our significance level is termed alpha (𝛂)
• We classically use p = 0.05
• Can choose based on the level of significance you deem appropriate
• BUT need to do this BEFORE you run the test (minimized bias)
Run test and compute test statistic
• We use the variables and data we have collected to fulfill a mathematical formula
• Each statistical test has a unique formula that calculates ‘the test statistic’
• Test critical value = the sig. level you set
• Test statistic = # your data gives
• This test statistic is then compared to a distribution to calculate a p-value
Compare Test Statistic and Critical Value
Given your data’s information, computers will make a mock distribution that includes your:
• Rejection region
• Critical values
• Where your test statistic lies on the distribution
Our test statistic is then plotted on that distribution
This is how we get our p-value!
Now we can accept or reject the null
There are 3 types of t-tests
One sample t-test: Comparing your mean value to a specific value
• Think reference value, threshold, or legal limit
2 sample t-test: Comparing 2 means from different populations/treatments
• Also known as independent
Paired t-test: Comparing the means of the difference of paired values
• Also known as dependent

The assumptions for t-tests differ slightly based on the type

LSD provides a way to express: What is the smallest difference we could have detected with our data?
• A non-significant t-test result does not prove “no difference”
It may mean:
• The true difference is small, OR
• The test wasn’t sensitive enough to detect it
• It really means we did not FIND a difference
LSD is the smallest difference between sample means that would be statistical sig. at a given α level
• A measure of test sensitivity.
• Helps back up non-significant results
• Shows how small an effect might have gone undetected
• ALWAYS report LSD w/ non sig. results!
• Affected by:
• Variance in the data
• Sample size
• Critical t-value for chosen 𝛼 (commonly 0.05)
• Smaller variance and larger n → smaller LSD (more sensitivity).
• Larger variance and smaller n → larger LSD (less sensitivity).
LSD is related to our probability of a type II error
Type II error (β) – fail to reject H0 when H0 is actually false
• Chance of β impacted by:
• True effect size )Δ = μ₁ − μ₂)
• Variability in the data
• Sample size (n)
• Chosen α level
• Power = 1 – β: probability of detecting true effect
Think of LSD as the resolution of your measuring tool
• Large LSD → more Type II errors (test is insensitive)
• Small LSD → fewer Type II errors (test is sensitive)
• Type II error = failing to detect a difference because the resolution was too coarse.
• Example: Measuring tree height to the nearest 1 m vs 10 cm.
• Same true difference, but finer measurement (smaller LSD) detects it.
The F-test determines if two population variances are equal using a special F distribution (same as Levene’s test!)
Null/Alternative Hypotheses:
H0: 𝜎 2/𝐴 = 𝜎 2/𝐵
Ha: 𝜎 2/𝐴 ≠ 𝜎 2/𝐵
Assumptions:
• Independence within and between samples
• Meets Normality Assumption (sensitive to non-normal and outliers)
• Consider log-transform if normality is violated
• No test for homogenous variances required (what we are testing)
F-Test/Levene’s test reporting template
We compared variances between Group A (n = 𝑛𝐴)and Group B (n = 𝑛𝐵). Sample variances were 𝑠 2/𝐴 = [value] and 𝑠 2/𝐵 = [value].
F-test value:
𝐹 𝑑𝑓1 = 𝑛𝐴 − 1, 𝑑𝑓2 = 𝑛𝐵 − 1 = 𝐹 , 𝑝 = 𝑝 (two−sided).
[Conclusion about variance equality].
Given these results, we [used Welch’s t-test / used pooled t-test] for comparing means.”
Figure Generations Requirements
• Plot Title
• Y and X axis labels w/ units
• Legend (if necessary)
• Error bars
• Indication of statistical difference
• Can be a * or letters (A, B, C)
Figure Caption Requirements
• General description of plot
• Sample sizes (n)
• Type of statistical test used (t-test, F-test, ANOVA, etc.)
• P-value
• Description of data and error (typically mean +/ SD or SE or CI.)
• Exact order and details vary…but you should include this info!
Results Section Requirements
• Include ALL the statistical information
• T values, F-values, etc.
• Exactly how different were your treatment groups?
• What was the LSD value if you rejected your null?
How to run T-test and F-test in Excel!
T-Tests
• Open the Real Statistics Window (ctrl + m)
• Navigate to Misc. Tab >> T-tests and nonparametric versions
• Highlight Group 1 and Group 2 Data
• Select appropriate test type (one sample, 2-sample, paired, parametric, non-parametric)
F-Tests
• Navigate to ANOVA tab >> One factor ANOVA
• Check Brown-Forsythe (F-test)
• This is equivalent to Levene’s test – but in most cases we use Levene’s
Test bc:
• It doesn’t require normality (F-test is strict)
• Can evaluate more than 2 groups
One way ANOVA or Single Factor
comparing means of k groups, k >2
Is there difference in mean growth rate under k number of different temperatures?
ANOVAs are parametric tests
Normally distributed
Homogenous variances

Two way ANOVA or MultiFactor (MANOVA)
comparing means of k >2 groups, impact of multiple factors on means
Is there difference in mean growth rate under k number of different temperatures and light AND is there an interaction of their effects?
ANOVAs are parametric tests
Normally distributed
Homogenous variances

When do we use ANOVA?
When we want to compare > 2 means among groups
• ANOVA is actually an extension of regression (cover that in a few weeks!)
Why not use a bajillion t-tests?
Inflates Type I error rate (a)
Rejecting the null hypothesis when it is actually true (false positive)
Each test has a 5% chance of being wrong = lots of chance for error
1 – (1 – a)n
A = type I error rate, n = number of means
Also think about it like:
P(Committing a Type I error w/ lots of T-tests) = P(0.05)+P(0.05)….(and so on)
Math isn’t exactly right, but it’s the same idea!
What Does ANOVA Tell Us?
ANOVA is an omnibus test:
It tells us if the group means are different
It doesn’t tell us which mean(s) are different
We have to do a Tukey Honest Significant Differences (HSD) test to determine that

Variable
the response measured
How does the pH and fertilizer dose affect the plant height of corn?
Variable = plant height
Factor
the explanatory treatment whose effects are tested
How does the pH and fertilizer dose affect the plant height of corn?
Factor(s) = pH and fertilizer
Levels
the categories of a factor
How does the pH and fertilizer dose affect the plant height of corn?
Levels
pH = 8.2, 8.3, 8.4, etc.
Fertilizer = 5 uM of N, 10 uM N, 15 uM N, etc.
Replicate
an independent observational unit within a level
How does the pH and fertilizer dose affect the plant height of corn?
Replicates
How many times each of the above treatments
combinations are repeated
One way or Multiway depends on the number of factors that you have
One-way ANOVA: one factor with ≥2 levels.
• Multiway ANOVA: ≥2 factors (two-way, three-way, more…) – Allows test of main effects of each factor and interactions of factors.

Statistical Assumptions to use ANOVA
We can use qualitative and quantitative tools
Qualitative = arbitrary scales like 5 stars, scale of 1 – 10
This makes it a little more versatile!
Random sampling and independent measurements
Parametric Assumptions
Residuals are approximately Normal
Transformations may be used when needed
Variances are (approximately) equal across groups
Transformations may be used when needed.

Calculating Residuals in Excel: Residual = Individual Value – Mean Value
Remember that negative residuals are okay
• They are telling you deviance from the mean
• Some will be higher
• Some will be lower
This means Normal distributions of residuals are centered around 0

How does ANOVA actually work?
Analysis of Variance looks at 2 things to determine differences
Within sample variance
Between sample variance
(how spread out the means are)
If samples are from identical populations within and between variance would be identical too


Homogenous variances are a requirement for ANOVA
So, taking the mean of each samples’ variance is a good estimate of within group total variance
• Variance = SD2 (s2) or equation
• This is our within variance estimate
• Also called residual or error variance

Estimating variance of population from the spread of sample means (Between variance)
• Remember that if we repeatedly sample a population, we will get a slightly different mean value each time
• The standard deviation of these ‘repeated samples’ is the standard error
• We are using spread of individuals in repeated samples (SD) to estimate the spread of the means we would expect if we were to repeatedly sample from that population (SE)

We can use the previous principle to determine between group variance
• Think of our different samples as repeated samples from the same population
• AKA how we typically calculate SE
• We can then calculate the SD around the overall mean (Grand mean) of the samples
• Using the standard deviation of sample means (SE) and # of measurements w/in each sample
Total variance = Between + Within

We now have between and within group variance, which we can compare to determine if there are differences
If we are comparing ONLY 2 variances which test, would we use?
F-test!
For classic F-test, F-statistic always has the bigger number on top
For ANOVA test, between is always the top, and within is the bottom
Rarely, between variation could be smaller than within

2 Factor and Repeated Measure ANOVAS work similarly, but are much more complicated
2 Factor is literally when you are examining 2 factors on a variable
You can have 3 factor when you have 3 factors, etc.
Levels of factors is unlimited
Repeated measures is when you are investigating the effect of things over time
Think of it like a paired t-test with lots of time points
There are repeated measures tests for each # of factors

There are 2 steps to interpreting ANOVA results
1. General ANOVA is there a difference among my means
2. Tukey HSD – Which means significantly differ from one another?
• Each is a different test you have to run in Real Statistics

Interpreting ANOVA Test

The Tukey Honest Significant Differences (HSD) test tells us which of our means are significantly different
Tukey is for balanced (similar n’s) designs
Arrange all samples means in order of increasing magnitude
Calculates the pairwise difference of sample means
Closer to a t-test
Uses a t-test analog to calculate the q-stat
Compares largest mean with the smallest mean
If those are not significantly different, then none of the in-betweens can be either
If they are, it moves on to largest mean with second smallest, etc. until all combinations have been evaluated

Interpreting Tukey HSD test
Tukey Test uses Q values, so it is comparing Q-crit to your Q-stat

How do you run ANOVA and Tukey in Excel?
Ctrl + m
ANOVA tab
Select appropriate test
One Factor for today’s exercise
2 Factor if investigating two, etc.
Check ANOVA Box
Check Tukey HSD Box
Leave everything else standard
Unless you’re changing your alpha levels
Highlight all columns you want to compare

How do you set up your data in Excel for ANOVA?
• Each sample’s data should be in its own labeled column
• Will have to rearrange from rectangular format


How do you label this on a graph?
• Still using letters and stars, but it get’s tricky

Scatter Figures
Show relationship between two continuous variables
Each point = one observation
Useful for:
Identifying correlations
Detecting outliers
Example: mean seed mass vs number of seeds produced
Key insight: unusual points stand out in scatterplots
Correlation and Simple Linear Regression
Purpose: quantify linear association and fit simple linear regression
Typically we:
1. Start with correlation
2. Move on to linear regression
What’s the difference between Correlation and Simple Linear Regression (SLR)?
Correlation:
How close is the relationship between these two variables to a straight line?
Simple Linear Regression (SLR):
What equation describes this linear relationship so I can predict one variable off the value of another?

CORRELATION IS NOT CAUSATION
Just because our variables are related, does not mean one is directly causing the changes in the other
• There could be LOTS of intermediary steps
• It could just randomly happen!
Correlation Test Overview

Is there a correlation between the height and weight of male and females?
Test Requirements
Random sampling and independence
Normal distribution of variables (for correlation)
Equal variance NOT REQUIRED TO EVALUATE
Only for regression
Linearity between X and Y
Normality Notes:
Use Shapiro-Wilk
Need to test both variables independently
Ex: Height and Weight
Need to test groups independently
Ex: Males and Females
Equal Variances Notes:
We aren’t calculating a mean
Residuals are N/A until we put a ‘best fit’ line (Regression)
Because we have nothing to ‘compare’ it too
Linearity Notes:
Visually access via scatterplot
Not all data is good for linear regression!
Don’t oversimplify trends
Can transform data to meet assumption
How do we describe and access scatterplots?
We examine:
Positive or negative
Strong, moderate, weak, or none
Correlation Hypotheses + Testing
Null: There is no linear relationship between the variables
Alternative: A linear relationship exists between the variables

How do we interpret r values?
|r| close to 1: strong linear association.
|r| ~ 0: little or no linear association.
Sign indicates direction
• + = increasing trend
• - = decreasing trend

The same r value can look very different so we should always include our scatterplot

Be careful interpreting r and p values w/ correlation
• Large n can make small r statistically significant
• Small n can yield non- significant results even with large |r|
• Report: r, n, p-value, and confidence interval when available.

Correlation Steps
Create the scatterplot
Does it mean assumption for linearity?
Test for normality
Separate groups and variables!
Run the correlation test to get correlation coefficient (r)
|r| close to 1: strong linear association.
|r| ~ 0: little or no linear association.
Sign indicates direction
+ = increasing trend
- = decreasing trend
r is used to calculate a p-value
This tells you if there is likely a linear relationship in the population
P = 0.05 still default sig. level
Simple linear regression takes correlation one step further
Purpose: describe and test a linear relationship between a predictor X and a response Y
• Model: 𝑌𝑖 = 𝛽0 + 𝛽1𝑋𝑖 + 𝜀𝑖, 𝜀𝑖 ∼ 𝒩 0, 𝜎2
• Parameters: intercept 𝛽0 and slope 𝛽1
• That’s the crazy math -> it’s just y = mx +b

SLR Test Overview

SLR Test Requirements
• Random sampling and independence
• Normal distribution of RESIDUALS (for regression)
• Equal variance of RESIDUALS AROUND THE LINE
• Linearity between X and Y
Assumptions Notes:
• RealStatistics will output a residual plot for you
• For data to be normal and have equal variance, you should have ‘random’ residual plots

Residuals are calculated by comparing your x and y true values to the predicted value by the equation
So, inherently, you must run your linear regression first…..it’s backwards, I know
At this point, you’ve probably already done correlation, so you have a good idea

SLR Hypotheses and Testing
𝐻0: 𝛽1 = 0 (no linear relationship in the population)
𝐻𝐴: 𝛽1 ≠ 0

So, what does the equation actually tell us?
Y = -224.50 + 5.96X
For men on average, every 1 in. increase in height = 5.96 lb. increase in weight
I can predict the average weight or height of man if I only have one of those variables
r = 0.86
A strong, positive correlation between height and weight of men
R2 = 0.73
73% of the variation in mens’ weights can be explained by variation in their height
P=0.001
There is a significant linear relationship in the larger population between height and weight

How to choose between correlation and regression?

We don’t report error with correlation or regression – that is communicated through our r values
We DON’T typically report an error value!
No SD or SE
Some stat packages will shade a confidence interval area for you, but you don’t really report any values
The math gets tricky!
How to run Correlation in RealStats
Open RealStats
• Corr tab
• Correlation Tests
• Select Pearson’s Correlation Coefficient
• Highlight your rearranged statistical data
How to display correlation output
Regression Figure Submission Checklist:
□ Chart Title
□ Axes Titles
□ Legend (if necessary)
□ Units on Axes
□ R value
□ P-value

How to run SLR in RealStats
Open RealStats
Reg tab
Multiple Linear Regression
Runs Normality and Variance tests at same time! No pre testing!!
Check the following boxes
Residuals
Normality
Heteroskedascity
How to interpret regression output

How to display SLR output
Regression Figure Submission Checklist:
□ Chart Title
□ Axes Titles
□ Legend (if necessary)
□ Units on Axes
□ Equation
□ R2 value (labeled as regular or adj. as
appropriate)
□ P-value
THE EQUATION PRODUCED BY EXCEL MAY BE WRONG!!! WRITE YOUR OWN IN A TEXT BOX

When do we use non-parametric tests?
• Distribution clearly not normal OR heavy outliers
• Small n where normality is doubtful
• Ordinal data or scores (ranks, ordered categories)
• Focus on medians or rank order rather than means

We must evaluate 2 assumptions:
Both assumptions (typically) must be met to use a parametric test
Exceptions homogenous variances if:
• Not comparing data
• T-test

Always evaluate normality and variances prior to analysis so you use the correct test!
1) Shapiro-Wilk Test – Is each group/treatment’s data normally distributed?
2) Levene’s Test - Are variances in the compared data homogenous?

How do non-parametric tests work?
• Replace raw values with ranks; test statistics use sums of ranks
• Ties use average ranks
• Average member described by median
• Less power than parametric tests - when Normality holds
• Robust to outliers

Non Parametric Test Assumptions
• Random, independent observations within groups
• Similar distribution shapes helps, not required to pass Levene’s Test
• Repeated-measures tests assume consistent blocking
• Paired differences roughly symmetric helps

Mann–Whitney U-Test (T-test Alterative)
• Alternative to T-test
• Compares two medians
• Does NOT require normality
• Works w/ ordinal data (scales)
Examples:
• Comparing median fish biomass between two habitats
• Comparing student test scores from two teaching methods when data are skewed
• Comparing reaction times between male and female participants

Mann Whitney U-Test Overview
Passes Levenes:
H0: Distributions of both groups are identical (no shift central tendancy)
HA: One distribution tends to have larger or smaller values than the other.
Fails Levenes:
If distributions have the same shape, this becomes a test of medians:
H0: median A = median B
HA: median A doesn’t = median B
Mann Whitney U v. T-test

How to in RealStats (Mann Whitney U)
Open Real Stats (Ctrl+m)
T-Tests and Non-parametric Equivalents
Check:
• Non-Parametric Box
• Include Exact Test

For nonparametric test output ONLY use data under Mann-Whitney U

Wilcoxon signed-rank (paired T-test alternative)
• Nonparametric paired t-test
• Two related samples, matched pairs, or repeated measures
• Tests whether the median of paired differences is zero
• Suitable for ordinal or continuous data that are not Normally distributed

Wilcoxon Signed Rank Examples
• Comparing fish length before and after a growth period
• Measuring oxygen concentration in water samples before and after treatment
• Evaluating student test scores before and after an instructional intervention

Wilcoxon Signed Rank Overview
H0: The median difference between pairs is zero
HA: The median difference between pairs isn’t zero
If the data are symmetric, the test assesses whether the location of the distribution of differences is shifted away from zero.

Wilcoxon Signed-Rank Test v. Paired t-test

How to in RealStats (Wilcoxon Signed Rank)
• Open Real Stats
• Misc >> T-Test and Nonparametric Alternatives
Check
• Two Paired Samples
• Non-parametric
• Include Exact Test

Only pay attention to things under Wilcoxon signed-rank test

Kruskal-Wallis Test (Non-parametric ANOVA)
• Alternative to ANOVA
• Compares medians across many groups
• Distributions should be approximately similar
• EX: all skewed right, not some skewed left and some skewed right
• Compares the ranks across groups, calculates sum of all ranks, compares to means of said ranks

Kruskal-Wallace Overview
H0: The populations all have the same median
HA: The populations do not all have the same median
After ANOVA we do a Tukey test -> We do NOT do this for Kruskal Wallace
• We say, there are (p < 0.05) are aren’t differences (p > 0.05)
• If we are interested in one comparison of means, we can run a separate Mann Whitney U test to compare
• Have to use serious correction factors for this!
• Options for computer to calculate for you, for now, DON’T

Kruskal Wallace in RealStats
• ANOVA >> Single Factor ANOVA
• Uncheck ANOVA
• Check Kruskal-Wallace
• Highlight Data as normal

Kruskal Wallis Test v. ANOVA

Spearman’s Rank Correlation (nonparametric Pearson’s correlation)
• Nonparametric measure of the strength and direction of a monotonic relationship
• Monotonic = relationship where both variables are moving in the same direction
• Appropriate when data are ordinal or not Normally distributed
• Data w/ extreme outlier
• Doesn’t have to be linear!
• Analogous to Pearson’s correlation but based on ranks rather than raw values

Use Spearman’s if you have extreme outliers or non linear shape

Use Spearman’s Correlation Coefficient if any of your variables are ranks or arbitrary scores
• Correlation between fish abundance and habitat quality scores
• Relationship between pollution rank and invertebrate diversity rank
• Association between student class rank and number of publications

Spearman’s Correlation Overview
Hypotheses
H0: Ps = 0 (no association between ranks)
HA: Ps ≠ 0 (association exists between ranks)
Running the test:
• Exactly the same as running Pearson’s correlation
• Use Spearman’s correlation coefficient instead
• This is why we test normality ahead of time
– so we know which one to use!
• Report the same metrics, specify used Spearman’s Correlation

Spearman’s v. Pearson’s

Spearman’s in RealStats
Corr >> Correlation Tests
Check:
• Spearman’s

How do we present median data?
• We use boxplots
• AKA box and whisker plot
• Line shows median value
• Edges of box show 25% of data in either direction (1 IQR)
• 1 IQR = 25% of the data
• Entire box therefore covers middle 50% of all data
• Error bars display 25th % - 1.5IQR
• Allows for quantification of outliers
• Outliers plotted seperately
Boxplots are helpful when visualizing nonparametric data

Chi-Squared Test Overview
• Analyzes the frequency of categorical outcomes
• Considered nonparametric
• Does not require evaluation of normality or homogenous variances
2 Types of tests:
1. Goodness of fit – compares observed to expected distribution
2. Test of Association – evaluates relationships between categorical variables

Chi-squared tests are primarily for categorical data
Types of data:
• Counts/Frequency Data
• Binary Data (0/1)
• Means are meaningless for categorical variables
For Example:
Do lobsters have a substrate preference?
(Goodness of fit – theoretically, they should choose all habits equally if there is no preference, 1 categorical variable)
Other examples of Chi-Squared Tests
• Compare observed vote counts to counts expected under a null hypothesis of equal preference
• Under theoretical distribution, no preference = 50/50 split
• Compare to results to determine preference
• Goodness of fit test (1 categorical variable)
• Comparing pass v. fail outcomes (binary) across different instructional methods (online v. in class)
• Categorical variable one = Pass/Fail
• Categorical variable two = Online/In person
• Test of Association to see if outcomes are related
Chi-squared goodness of fit (GOF) measures how far a sample distribution deviates from a theoretical one
Do observed samples conform to a specified theoretical distribution?
• Like a personalized Shapiro-Wilk (normal distribution)
