SlideShare a Scribd company logo
1 of 30
Glimpse of T test, ANOVA and
ANCOVA
Prachi Bari
Sanjana Ghadigaonkar
Samrat Parage
Vaibhav Deshmukh
Pragya Sinha
Aritra Das
T test
A statistical examination of two population means
T - Test
• A t-test is any statistical hypothesis test in which the test statistic follows a Student's t-
distribution under the null hypothesis. It can be used to determine if two sets of data are
significantly different from each other.
• In probability and statistics, Student's t-distribution (or simply the t-distribution) is any
member of a family of continuous probability distributions that arises when estimating
the mean of a normally distributed population in situations where the sample size is
small and population standard deviation is unknown.
• Let 𝑋1, 𝑋2, … , 𝑋 𝑛 be independent and identically distributed as N(𝜇, 𝜎2
), i.e. this is a
sample of size n from a normally distributed population with expected value 𝜇 and
unknown variance 𝜎2
.
Assumptions
• Interval or ratio scale of measurement
• X follows a normal distribution with mean μ and variance σ2
• Z and s are independent,
• Where Z= Standard normal variable
s =The ratio of sample standard deviation over population
standard deviation
• Generally used when sample size is <30.
One sample T test statistic
• The random variable
T=
𝑋−𝜇
𝑠
𝑛
Where, 𝑆2
=
1
𝑛−1 𝑖=1
𝑛
(𝑋𝑖 − 𝑋)2
has a Student's t-distribution with n − 1 degrees of freedom.
SAS Code for One sample T test
Example:
title 'One-Sample t Test';
data time;
input time @@;
datalines;
43 90 84 87 116 95 86 99 93 92
121 71 66 98 79 102 60 112 105 98
;
run;
proc ttest h0=80 alpha=0.05;
var time;
run;
Output
Here, we see that the p value (0.0329) < α (0.05) hence we reject 𝐻 𝑜.
Hence we conclude that the mean weight of given sample is not equal to 80.
One-Sample t Test :
Types of Two sample T – Test
• Independent Two Sample T – Test:
The independent samples t-test is used when two separate sets
of independent and identically distributed samples are obtained,
from each of the two populations being compared.
• Dependent (Paired) Two Sample T – Test:
A typical example of the repeated measures t-test would be
where subjects are tested prior to a treatment, say for high blood
pressure, and the same subjects are tested again after treatment
with a blood-pressure lowering medication.
Assumptions of Independent two sample t-test
Given two groups 1 and 2 this test is only applicable when:
• The two sample sizes (that is, the number n of participants of each group) are equal
• The two samples have the same variance
• Samples have been randomly drawn independent of each other
Testing Assumptions
Normality:- Shapiro–Wilk or Kolmogorov–Smirnov test, or it can be
assessed graphically using a normal quantile plot
If the two groups are normally distributed then to check
equality of variance we use F - Test If normality is rejected then we use Wilcoxon Test.
Both the assumptions are satisfied thus we go
for two sample T - Test
If variance of two groups is not equal then
we use Welch Test
Test statistic
Where,
Hypothesis
Here the hypothesis to be tested is:
𝐻 𝑜: 𝜇1 = 𝜇2
vs
𝐻1: 𝜇1 ≠ 𝜇2
Independent Two sample T – test in SAS
Example:
data wt;
input group $ wt @@;
datalines;
Ind 85 Ind 70 Ind 64 Ind 87 Ind 76 Ind 95 Ind 67 Ind 87 Ind 93 Ind 82
Aus 90 Aus 95 Aus 103 Aus 107 Aus 95 Aus 112 Aus 98 Aus 92 Aus 98 Aus 115
;
run;
proc ttest h0=0 alpha=0.05;
class group;
var wt;
run;
Output
Paired Two sample T – test in SAS
Example:
data wt;
input Before After @@;
datalines;
120 128 140 132 126 118 124 131 128 125 130 132 130 131 140 141 126 129 118 127
135 137 127 135
;
run;
proc ttest data=wt sides=2 alpha=0.05 h0=0;
title "Paired sample t-test";
paired Before * After;
run;
Output
The TTEST Procedure
Difference: Before - After
ANOVA
ANOVA – Analysis Of Variance
Analysis of variance (ANOVA) is a collection of statistical models used to
analyze the differences among group means.
• The mathematical model that describes the relationship between the response and
treatment for the one way ANOVA is given by
𝑌𝑖𝑗 = µ + α𝑖 + ε𝑖𝑗 , i = 1,2….k, j = 1,2,…... 𝑛𝑖
where, 𝑌𝑖𝑗 : 𝑗 𝑡ℎ
observation on 𝑖 𝑡ℎ
treatment,
µ : common effect for the whole experiment,
α𝑖 : 𝑖 𝑡ℎ
treatment effect,
ε𝑖𝑗 : random error.
One – Way ANOVA
Hypothesis of one – way ANOVA
H0: The means of all the groups are equal.
Vs
H1: Not all of the group means are the same.
• The normality assumption:
dependent variable should be approximately normally distributed
• The homogeneity of variance assumption:
variance of each group should be approximately equal
• The independence assumption:
observations should be independent of each other
Assumptions of one way-ANOVA
Example
• Suppose we are testing a new drug to see if it helps reduce the time to recover from a
fever. We decide to test the drug on three different races (Caucasian, African American,
and Hispanic. We randomly select 10 test subjects from each of those races, so all
together, we have 30 test subjects.
• The response variable is the time in minutes after taking the medicine before the fever is
reduced.
Proc anova data=time;
class gender race;
model time=gender race;
run;
SAS code for one-way ANOVA
• Two-way ANOVA is a type of study design with one numerical outcome variable
and two categorical explanatory variables.
• Mathematical model of two –way ANOVA is as follows
𝑌𝑖𝑗 = µ + α𝑖 + 𝛽𝑗 + γ𝑖𝑗 + ε𝑖𝑗𝑘
where µ is overall mean effect
α𝑖 is effect due to 𝑖 𝑡ℎ level of first factor
𝛽𝑗 is effect due to 𝑗 𝑡ℎ level of second factor
γ𝑖𝑗 is effect due to interaction between 𝑖 𝑡ℎ
level of first factor and 𝑗 𝑡ℎ
level of second factor
Two – Way ANOVA
Assumptions:
• The populations from which the samples were obtained must be normally or approximately
normally distributed.
• The samples must be independent.
• The variances of the populations must be equal.
• The groups must have the same sample size.
Proc anova data=time;
class gender race;
model time=gender race;
run;
SAS code for Two-way ANOVA
Output of two-way ANOVA
ANCOVA
Analysis of covariance (ANCOVA) is a general linear model which blends
ANOVA and regression.
ANCOVA
• ANCOVA by definition is a general linear model that includes both ANOVA (categorical)
predictors and Regression (continuous) predictors.
• ANCOVA examines the influence of an independent variable on a dependent variable
while removing the effect of the covariate factor.
• ANCOVA first conducts a regression of the independent variable (i.e., the covariate) on
the dependent variable.
• The residuals (the unexplained variance in the regression model) are then subject to an
ANOVA.
ANCOVA in other words…
• Analysis of Covariance (ANCOVA) is a statistical test related to ANOVA
• It tests whether there is a significant difference between groups after controlling for
variance explained by a covariate
• A covariate (CV) is a continuous variable that correlates with the dependent variable (DV)
• This is one way that you can run a statistical test with both categorical and continuous
independent variables
Purposes of ANCOVA
Increase sensitivity of F test
• Removes predictable variance from the error term
• Improves power of the analysis
Adjustment of Covariate Effect
Partitioning variance in ANOVA
Variance
Variance due to Treatment Within cell variance(Error)
Variance due to Covariate
Partitioning variance in ANCOVA
Variance
Variance due to Treatment Within Cell Varaince(Error)
Relationship between CV and DV
Hypotheses for ANCOVA
H0: the group means are equal after controlling for the covariate
Vs
H1: the group means are not equal after controlling for the covariate
• linearity of regression: The regression relationship between the dependent variable and
concomitant variables must be linear.
• homogeneity of error variances: The error is a random variable zero mean and equal
variances for different treatment classes and observations
• independence of error terms: The errors are uncorrelated. That is that the error
covariance matrix is diagonal.
• normality of error terms: The residual (error terms) should be normally distributed
𝜀𝑖𝑗~𝑁(0, 𝜎2)
• homogeneity of regression slopes: The slopes of the different regression lines should be
equivalent, i.e., regression lines should be parallel among groups.
Assumptions
Choosing Covariates
Variables that affect or have the potential to affect the dependent variable
• Demographic information
• Inherent characteristics
• Differences in group characteristics due to sampling
Number of covariates depends on:
• Known relationship or previous research
• No. of independent variables or groups
• Total no. of subjects
Example
Suppose we want to compare the effect of drugs on the weights of a particular group of
patients(homogeneous among themselves). We can analyze the data by performing the ANCOVA by
regarding:
𝑦: the final weight of the patients taking drugs, after a specified period as the response variable.
𝑥: the initial weight of the animals at the time of starting the experiment as the covariate.
Model
So, our model becomes:
𝑦𝑖𝑗 = 𝜇 + 𝛼𝑖 + 𝛽 𝑥𝑖𝑗 − 𝑥00 + 𝜀𝑖𝑗 Where,
• 𝜇 is the general mean effect
• 𝛼𝑖 is the (fixed) additional effect due to the 𝑖th treatment (i=1,2,….,p)
• 𝜀𝑖𝑗 is the random error effect (j=1,2,…, 𝑛𝑖)
• 𝛽 is the coefficient of regression of y on x
• 𝑥𝑖𝑗 is the value of covariate variable corresponding to the response variable 𝑦𝑖𝑗
• PROC MIXED data =<name of the dataset>;
CLASS variables ;
MODEL dependent = < fixed-effects > <covariates> < / options > ;
LSMEANS fixed-effects < / options > ;
run;
SAS Codes in ANCOVA
PROC MIXED OUTPUT
Questions
Anova, ancova

More Related Content

What's hot (20)

Non-Parametric Tests
Non-Parametric TestsNon-Parametric Tests
Non-Parametric Tests
 
Analysis of variance (ANOVA)
Analysis of variance (ANOVA)Analysis of variance (ANOVA)
Analysis of variance (ANOVA)
 
Regression
RegressionRegression
Regression
 
Anova, ancova, manova thiyagu
Anova, ancova, manova   thiyaguAnova, ancova, manova   thiyagu
Anova, ancova, manova thiyagu
 
Multivariate Analysis
Multivariate AnalysisMultivariate Analysis
Multivariate Analysis
 
Measures of variability
Measures of variabilityMeasures of variability
Measures of variability
 
Two-Way ANOVA Overview & SPSS interpretation
Two-Way ANOVA Overview & SPSS interpretationTwo-Way ANOVA Overview & SPSS interpretation
Two-Way ANOVA Overview & SPSS interpretation
 
What is a partial correlation?
What is a partial correlation?What is a partial correlation?
What is a partial correlation?
 
Analysis of variance anova
Analysis of variance anovaAnalysis of variance anova
Analysis of variance anova
 
Assumptions about parametric and non parametric tests
Assumptions about parametric and non parametric testsAssumptions about parametric and non parametric tests
Assumptions about parametric and non parametric tests
 
{ANOVA} PPT-1.pptx
{ANOVA} PPT-1.pptx{ANOVA} PPT-1.pptx
{ANOVA} PPT-1.pptx
 
Analysis of variance ppt @ bec doms
Analysis of variance ppt @ bec domsAnalysis of variance ppt @ bec doms
Analysis of variance ppt @ bec doms
 
Anova in easyest way
Anova in easyest wayAnova in easyest way
Anova in easyest way
 
Analysis of variance (ANOVA)
Analysis of variance (ANOVA)Analysis of variance (ANOVA)
Analysis of variance (ANOVA)
 
Repeated Measures ANOVA
Repeated Measures ANOVARepeated Measures ANOVA
Repeated Measures ANOVA
 
Parametric test - t Test, ANOVA, ANCOVA, MANOVA
Parametric test  - t Test, ANOVA, ANCOVA, MANOVAParametric test  - t Test, ANOVA, ANCOVA, MANOVA
Parametric test - t Test, ANOVA, ANCOVA, MANOVA
 
Anova ancova manova_mancova
Anova  ancova manova_mancovaAnova  ancova manova_mancova
Anova ancova manova_mancova
 
Degree of freedom
Degree of freedomDegree of freedom
Degree of freedom
 
non parametric statistics
non parametric statisticsnon parametric statistics
non parametric statistics
 
In Anova
In  AnovaIn  Anova
In Anova
 

Viewers also liked

Null hypothesis for an ANCOVA
Null hypothesis for an ANCOVANull hypothesis for an ANCOVA
Null hypothesis for an ANCOVAKen Plummer
 
The Difference Between t-tests and ANOVAs
The Difference Between t-tests and ANOVAsThe Difference Between t-tests and ANOVAs
The Difference Between t-tests and ANOVAsKen Plummer
 
Running & Reporting an One-way ANCOVA in SPSS
Running & Reporting an One-way ANCOVA in SPSSRunning & Reporting an One-way ANCOVA in SPSS
Running & Reporting an One-way ANCOVA in SPSSKen Plummer
 
Reporting an ANCOVA
Reporting an ANCOVAReporting an ANCOVA
Reporting an ANCOVAKen Plummer
 
What is an ANCOVA?
What is an ANCOVA?What is an ANCOVA?
What is an ANCOVA?Ken Plummer
 
Tutorial normal v skew distributions
Tutorial   normal v skew distributionsTutorial   normal v skew distributions
Tutorial normal v skew distributionsKen Plummer
 
Quickreminder nature of the data (relationship)
Quickreminder nature of the data (relationship)Quickreminder nature of the data (relationship)
Quickreminder nature of the data (relationship)Ken Plummer
 
Tutorial parametric v. non-parametric
Tutorial   parametric v. non-parametricTutorial   parametric v. non-parametric
Tutorial parametric v. non-parametricKen Plummer
 
Tutorial repeated measures ANOVA
Tutorial   repeated measures ANOVATutorial   repeated measures ANOVA
Tutorial repeated measures ANOVAKen Plummer
 
Sampling Design
Sampling DesignSampling Design
Sampling DesignJale Nonan
 
Sample size
Sample sizeSample size
Sample sizezubis
 
Transgenic animals
Transgenic animalsTransgenic animals
Transgenic animalsdamarisb
 
Student's T-test, Paired T-Test, ANOVA & Proportionate Test
Student's T-test, Paired T-Test, ANOVA & Proportionate TestStudent's T-test, Paired T-Test, ANOVA & Proportionate Test
Student's T-test, Paired T-Test, ANOVA & Proportionate TestAzmi Mohd Tamil
 

Viewers also liked (20)

Null hypothesis for an ANCOVA
Null hypothesis for an ANCOVANull hypothesis for an ANCOVA
Null hypothesis for an ANCOVA
 
T15 ancova
T15 ancovaT15 ancova
T15 ancova
 
Mancova
MancovaMancova
Mancova
 
The Difference Between t-tests and ANOVAs
The Difference Between t-tests and ANOVAsThe Difference Between t-tests and ANOVAs
The Difference Between t-tests and ANOVAs
 
T-test (Revised version)
T-test (Revised version)T-test (Revised version)
T-test (Revised version)
 
Running & Reporting an One-way ANCOVA in SPSS
Running & Reporting an One-way ANCOVA in SPSSRunning & Reporting an One-way ANCOVA in SPSS
Running & Reporting an One-way ANCOVA in SPSS
 
Reporting an ANCOVA
Reporting an ANCOVAReporting an ANCOVA
Reporting an ANCOVA
 
What is an ANCOVA?
What is an ANCOVA?What is an ANCOVA?
What is an ANCOVA?
 
Tutorial normal v skew distributions
Tutorial   normal v skew distributionsTutorial   normal v skew distributions
Tutorial normal v skew distributions
 
Quickreminder nature of the data (relationship)
Quickreminder nature of the data (relationship)Quickreminder nature of the data (relationship)
Quickreminder nature of the data (relationship)
 
Tutorial parametric v. non-parametric
Tutorial   parametric v. non-parametricTutorial   parametric v. non-parametric
Tutorial parametric v. non-parametric
 
Tutorial repeated measures ANOVA
Tutorial   repeated measures ANOVATutorial   repeated measures ANOVA
Tutorial repeated measures ANOVA
 
Sampling Design
Sampling DesignSampling Design
Sampling Design
 
Sample size calculation
Sample size calculationSample size calculation
Sample size calculation
 
Sample size
Sample sizeSample size
Sample size
 
Experimental Design
Experimental DesignExperimental Design
Experimental Design
 
Transgenic animals
Transgenic animalsTransgenic animals
Transgenic animals
 
Research Design
Research DesignResearch Design
Research Design
 
Student's T-test, Paired T-Test, ANOVA & Proportionate Test
Student's T-test, Paired T-Test, ANOVA & Proportionate TestStudent's T-test, Paired T-Test, ANOVA & Proportionate Test
Student's T-test, Paired T-Test, ANOVA & Proportionate Test
 
P value
P valueP value
P value
 

Similar to Anova, ancova

Statistics for Anaesthesiologists
Statistics for AnaesthesiologistsStatistics for Anaesthesiologists
Statistics for Anaesthesiologistsxeonfusion
 
Testing of hypothesis.pptx
Testing of hypothesis.pptxTesting of hypothesis.pptx
Testing of hypothesis.pptxSyedaKumail
 
(Individuals With Disabilities Act Transformation Over the Years)D
(Individuals With Disabilities Act Transformation Over the Years)D(Individuals With Disabilities Act Transformation Over the Years)D
(Individuals With Disabilities Act Transformation Over the Years)DSilvaGraf83
 
(Individuals With Disabilities Act Transformation Over the Years)D
(Individuals With Disabilities Act Transformation Over the Years)D(Individuals With Disabilities Act Transformation Over the Years)D
(Individuals With Disabilities Act Transformation Over the Years)DMoseStaton39
 
Parametric & non-parametric
Parametric & non-parametricParametric & non-parametric
Parametric & non-parametricSoniaBabaee
 
Anova single factor
Anova single factorAnova single factor
Anova single factorDhruv Patel
 
T test^jsample size^j ethics
T test^jsample size^j ethicsT test^jsample size^j ethics
T test^jsample size^j ethicsAbhishek Thakur
 
Parametric tests
Parametric testsParametric tests
Parametric testsheena45
 
Parametric Test by Vikramjit Singh
Parametric Test  by  Vikramjit SinghParametric Test  by  Vikramjit Singh
Parametric Test by Vikramjit SinghVikramjit Singh
 
Anova single factor
Anova single factorAnova single factor
Anova single factorDhruv Patel
 
Statistical test in spss
Statistical test in spssStatistical test in spss
Statistical test in spssBipin Neupane
 
ANOVA_PDF.pdf biostatistics course material
ANOVA_PDF.pdf biostatistics course materialANOVA_PDF.pdf biostatistics course material
ANOVA_PDF.pdf biostatistics course materialAmanuelIbrahim
 

Similar to Anova, ancova (20)

Statistics for Anaesthesiologists
Statistics for AnaesthesiologistsStatistics for Anaesthesiologists
Statistics for Anaesthesiologists
 
Shovan anova main
Shovan anova mainShovan anova main
Shovan anova main
 
Parametric tests
Parametric testsParametric tests
Parametric tests
 
Testing of hypothesis.pptx
Testing of hypothesis.pptxTesting of hypothesis.pptx
Testing of hypothesis.pptx
 
1 ANOVA.ppt
1 ANOVA.ppt1 ANOVA.ppt
1 ANOVA.ppt
 
Applied statistics part 3
Applied statistics part 3Applied statistics part 3
Applied statistics part 3
 
mean comparison.pptx
mean comparison.pptxmean comparison.pptx
mean comparison.pptx
 
mean comparison.pptx
mean comparison.pptxmean comparison.pptx
mean comparison.pptx
 
(Individuals With Disabilities Act Transformation Over the Years)D
(Individuals With Disabilities Act Transformation Over the Years)D(Individuals With Disabilities Act Transformation Over the Years)D
(Individuals With Disabilities Act Transformation Over the Years)D
 
(Individuals With Disabilities Act Transformation Over the Years)D
(Individuals With Disabilities Act Transformation Over the Years)D(Individuals With Disabilities Act Transformation Over the Years)D
(Individuals With Disabilities Act Transformation Over the Years)D
 
Parametric & non-parametric
Parametric & non-parametricParametric & non-parametric
Parametric & non-parametric
 
Anova single factor
Anova single factorAnova single factor
Anova single factor
 
T test^jsample size^j ethics
T test^jsample size^j ethicsT test^jsample size^j ethics
T test^jsample size^j ethics
 
FandTtests.ppt
FandTtests.pptFandTtests.ppt
FandTtests.ppt
 
Parametric tests
Parametric testsParametric tests
Parametric tests
 
Parametric Test by Vikramjit Singh
Parametric Test  by  Vikramjit SinghParametric Test  by  Vikramjit Singh
Parametric Test by Vikramjit Singh
 
Anova single factor
Anova single factorAnova single factor
Anova single factor
 
Workshop on Data Analysis and Result Interpretation in Social Science Researc...
Workshop on Data Analysis and Result Interpretation in Social Science Researc...Workshop on Data Analysis and Result Interpretation in Social Science Researc...
Workshop on Data Analysis and Result Interpretation in Social Science Researc...
 
Statistical test in spss
Statistical test in spssStatistical test in spss
Statistical test in spss
 
ANOVA_PDF.pdf biostatistics course material
ANOVA_PDF.pdf biostatistics course materialANOVA_PDF.pdf biostatistics course material
ANOVA_PDF.pdf biostatistics course material
 

Recently uploaded

Smarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxSmarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxolyaivanovalion
 
Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfLars Albertsson
 
04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationshipsccctableauusergroup
 
B2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docxB2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docxStephen266013
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAroojKhan71
 
定制英国白金汉大学毕业证(UCB毕业证书) 成绩单原版一比一
定制英国白金汉大学毕业证(UCB毕业证书)																			成绩单原版一比一定制英国白金汉大学毕业证(UCB毕业证书)																			成绩单原版一比一
定制英国白金汉大学毕业证(UCB毕业证书) 成绩单原版一比一ffjhghh
 
Ukraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSUkraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSAishani27
 
Generative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusGenerative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusTimothy Spann
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxolyaivanovalion
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz1
 
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service BhilaiLow Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service BhilaiSuhani Kapoor
 
Log Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxLog Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxJohnnyPlasten
 
VidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxVidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxolyaivanovalion
 
Data-Analysis for Chicago Crime Data 2023
Data-Analysis for Chicago Crime Data  2023Data-Analysis for Chicago Crime Data  2023
Data-Analysis for Chicago Crime Data 2023ymrp368
 
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...Suhani Kapoor
 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptxAnupama Kate
 
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfMarket Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfRachmat Ramadhan H
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfLars Albertsson
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Halmar dropshipping via API with DroFx
Halmar  dropshipping  via API with DroFxHalmar  dropshipping  via API with DroFx
Halmar dropshipping via API with DroFxolyaivanovalion
 

Recently uploaded (20)

Smarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxSmarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptx
 
Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdf
 
04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships
 
B2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docxB2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docx
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
 
定制英国白金汉大学毕业证(UCB毕业证书) 成绩单原版一比一
定制英国白金汉大学毕业证(UCB毕业证书)																			成绩单原版一比一定制英国白金汉大学毕业证(UCB毕业证书)																			成绩单原版一比一
定制英国白金汉大学毕业证(UCB毕业证书) 成绩单原版一比一
 
Ukraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSUkraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICS
 
Generative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusGenerative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and Milvus
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptx
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signals
 
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service BhilaiLow Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
 
Log Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxLog Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptx
 
VidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxVidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptx
 
Data-Analysis for Chicago Crime Data 2023
Data-Analysis for Chicago Crime Data  2023Data-Analysis for Chicago Crime Data  2023
Data-Analysis for Chicago Crime Data 2023
 
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx
 
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfMarket Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdf
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
 
Halmar dropshipping via API with DroFx
Halmar  dropshipping  via API with DroFxHalmar  dropshipping  via API with DroFx
Halmar dropshipping via API with DroFx
 

Anova, ancova

  • 1. Glimpse of T test, ANOVA and ANCOVA Prachi Bari Sanjana Ghadigaonkar Samrat Parage Vaibhav Deshmukh Pragya Sinha Aritra Das
  • 2. T test A statistical examination of two population means
  • 3. T - Test • A t-test is any statistical hypothesis test in which the test statistic follows a Student's t- distribution under the null hypothesis. It can be used to determine if two sets of data are significantly different from each other. • In probability and statistics, Student's t-distribution (or simply the t-distribution) is any member of a family of continuous probability distributions that arises when estimating the mean of a normally distributed population in situations where the sample size is small and population standard deviation is unknown. • Let 𝑋1, 𝑋2, … , 𝑋 𝑛 be independent and identically distributed as N(𝜇, 𝜎2 ), i.e. this is a sample of size n from a normally distributed population with expected value 𝜇 and unknown variance 𝜎2 .
  • 4. Assumptions • Interval or ratio scale of measurement • X follows a normal distribution with mean μ and variance σ2 • Z and s are independent, • Where Z= Standard normal variable s =The ratio of sample standard deviation over population standard deviation • Generally used when sample size is <30. One sample T test statistic • The random variable T= 𝑋−𝜇 𝑠 𝑛 Where, 𝑆2 = 1 𝑛−1 𝑖=1 𝑛 (𝑋𝑖 − 𝑋)2 has a Student's t-distribution with n − 1 degrees of freedom.
  • 5. SAS Code for One sample T test Example: title 'One-Sample t Test'; data time; input time @@; datalines; 43 90 84 87 116 95 86 99 93 92 121 71 66 98 79 102 60 112 105 98 ; run; proc ttest h0=80 alpha=0.05; var time; run;
  • 6. Output Here, we see that the p value (0.0329) < α (0.05) hence we reject 𝐻 𝑜. Hence we conclude that the mean weight of given sample is not equal to 80. One-Sample t Test :
  • 7. Types of Two sample T – Test • Independent Two Sample T – Test: The independent samples t-test is used when two separate sets of independent and identically distributed samples are obtained, from each of the two populations being compared. • Dependent (Paired) Two Sample T – Test: A typical example of the repeated measures t-test would be where subjects are tested prior to a treatment, say for high blood pressure, and the same subjects are tested again after treatment with a blood-pressure lowering medication.
  • 8. Assumptions of Independent two sample t-test Given two groups 1 and 2 this test is only applicable when: • The two sample sizes (that is, the number n of participants of each group) are equal • The two samples have the same variance • Samples have been randomly drawn independent of each other Testing Assumptions Normality:- Shapiro–Wilk or Kolmogorov–Smirnov test, or it can be assessed graphically using a normal quantile plot If the two groups are normally distributed then to check equality of variance we use F - Test If normality is rejected then we use Wilcoxon Test. Both the assumptions are satisfied thus we go for two sample T - Test If variance of two groups is not equal then we use Welch Test
  • 9. Test statistic Where, Hypothesis Here the hypothesis to be tested is: 𝐻 𝑜: 𝜇1 = 𝜇2 vs 𝐻1: 𝜇1 ≠ 𝜇2
  • 10. Independent Two sample T – test in SAS Example: data wt; input group $ wt @@; datalines; Ind 85 Ind 70 Ind 64 Ind 87 Ind 76 Ind 95 Ind 67 Ind 87 Ind 93 Ind 82 Aus 90 Aus 95 Aus 103 Aus 107 Aus 95 Aus 112 Aus 98 Aus 92 Aus 98 Aus 115 ; run; proc ttest h0=0 alpha=0.05; class group; var wt; run;
  • 12. Paired Two sample T – test in SAS Example: data wt; input Before After @@; datalines; 120 128 140 132 126 118 124 131 128 125 130 132 130 131 140 141 126 129 118 127 135 137 127 135 ; run; proc ttest data=wt sides=2 alpha=0.05 h0=0; title "Paired sample t-test"; paired Before * After; run; Output The TTEST Procedure Difference: Before - After
  • 13. ANOVA ANOVA – Analysis Of Variance Analysis of variance (ANOVA) is a collection of statistical models used to analyze the differences among group means.
  • 14. • The mathematical model that describes the relationship between the response and treatment for the one way ANOVA is given by 𝑌𝑖𝑗 = µ + α𝑖 + ε𝑖𝑗 , i = 1,2….k, j = 1,2,…... 𝑛𝑖 where, 𝑌𝑖𝑗 : 𝑗 𝑡ℎ observation on 𝑖 𝑡ℎ treatment, µ : common effect for the whole experiment, α𝑖 : 𝑖 𝑡ℎ treatment effect, ε𝑖𝑗 : random error. One – Way ANOVA Hypothesis of one – way ANOVA H0: The means of all the groups are equal. Vs H1: Not all of the group means are the same.
  • 15. • The normality assumption: dependent variable should be approximately normally distributed • The homogeneity of variance assumption: variance of each group should be approximately equal • The independence assumption: observations should be independent of each other Assumptions of one way-ANOVA Example • Suppose we are testing a new drug to see if it helps reduce the time to recover from a fever. We decide to test the drug on three different races (Caucasian, African American, and Hispanic. We randomly select 10 test subjects from each of those races, so all together, we have 30 test subjects. • The response variable is the time in minutes after taking the medicine before the fever is reduced.
  • 16. Proc anova data=time; class gender race; model time=gender race; run; SAS code for one-way ANOVA
  • 17.
  • 18. • Two-way ANOVA is a type of study design with one numerical outcome variable and two categorical explanatory variables. • Mathematical model of two –way ANOVA is as follows 𝑌𝑖𝑗 = µ + α𝑖 + 𝛽𝑗 + γ𝑖𝑗 + ε𝑖𝑗𝑘 where µ is overall mean effect α𝑖 is effect due to 𝑖 𝑡ℎ level of first factor 𝛽𝑗 is effect due to 𝑗 𝑡ℎ level of second factor γ𝑖𝑗 is effect due to interaction between 𝑖 𝑡ℎ level of first factor and 𝑗 𝑡ℎ level of second factor Two – Way ANOVA Assumptions: • The populations from which the samples were obtained must be normally or approximately normally distributed. • The samples must be independent. • The variances of the populations must be equal. • The groups must have the same sample size.
  • 19. Proc anova data=time; class gender race; model time=gender race; run; SAS code for Two-way ANOVA Output of two-way ANOVA
  • 20. ANCOVA Analysis of covariance (ANCOVA) is a general linear model which blends ANOVA and regression.
  • 21. ANCOVA • ANCOVA by definition is a general linear model that includes both ANOVA (categorical) predictors and Regression (continuous) predictors. • ANCOVA examines the influence of an independent variable on a dependent variable while removing the effect of the covariate factor. • ANCOVA first conducts a regression of the independent variable (i.e., the covariate) on the dependent variable. • The residuals (the unexplained variance in the regression model) are then subject to an ANOVA.
  • 22. ANCOVA in other words… • Analysis of Covariance (ANCOVA) is a statistical test related to ANOVA • It tests whether there is a significant difference between groups after controlling for variance explained by a covariate • A covariate (CV) is a continuous variable that correlates with the dependent variable (DV) • This is one way that you can run a statistical test with both categorical and continuous independent variables Purposes of ANCOVA Increase sensitivity of F test • Removes predictable variance from the error term • Improves power of the analysis
  • 23. Adjustment of Covariate Effect Partitioning variance in ANOVA Variance Variance due to Treatment Within cell variance(Error) Variance due to Covariate Partitioning variance in ANCOVA Variance Variance due to Treatment Within Cell Varaince(Error)
  • 24. Relationship between CV and DV Hypotheses for ANCOVA H0: the group means are equal after controlling for the covariate Vs H1: the group means are not equal after controlling for the covariate
  • 25. • linearity of regression: The regression relationship between the dependent variable and concomitant variables must be linear. • homogeneity of error variances: The error is a random variable zero mean and equal variances for different treatment classes and observations • independence of error terms: The errors are uncorrelated. That is that the error covariance matrix is diagonal. • normality of error terms: The residual (error terms) should be normally distributed 𝜀𝑖𝑗~𝑁(0, 𝜎2) • homogeneity of regression slopes: The slopes of the different regression lines should be equivalent, i.e., regression lines should be parallel among groups. Assumptions
  • 26. Choosing Covariates Variables that affect or have the potential to affect the dependent variable • Demographic information • Inherent characteristics • Differences in group characteristics due to sampling Number of covariates depends on: • Known relationship or previous research • No. of independent variables or groups • Total no. of subjects Example Suppose we want to compare the effect of drugs on the weights of a particular group of patients(homogeneous among themselves). We can analyze the data by performing the ANCOVA by regarding: 𝑦: the final weight of the patients taking drugs, after a specified period as the response variable. 𝑥: the initial weight of the animals at the time of starting the experiment as the covariate.
  • 27. Model So, our model becomes: 𝑦𝑖𝑗 = 𝜇 + 𝛼𝑖 + 𝛽 𝑥𝑖𝑗 − 𝑥00 + 𝜀𝑖𝑗 Where, • 𝜇 is the general mean effect • 𝛼𝑖 is the (fixed) additional effect due to the 𝑖th treatment (i=1,2,….,p) • 𝜀𝑖𝑗 is the random error effect (j=1,2,…, 𝑛𝑖) • 𝛽 is the coefficient of regression of y on x • 𝑥𝑖𝑗 is the value of covariate variable corresponding to the response variable 𝑦𝑖𝑗 • PROC MIXED data =<name of the dataset>; CLASS variables ; MODEL dependent = < fixed-effects > <covariates> < / options > ; LSMEANS fixed-effects < / options > ; run; SAS Codes in ANCOVA

Editor's Notes

  1. Group means are adjusted based on the how much amount of effect the covariate actually has . The formula does kind of a mini regression equation and figures out how much variance is explained in the outcome by the covariate that we might have and then it can actually give a quantitative value to say this covariate is either increasing or decreasing the outcome variable by this amount 5points or 10 points. And the group mean is just adjusted by that 5 point or 10 point the covariate actually had. So the formula looks at the relationship between the covariate and the outcome and then predicts how much variance it has with the outcome an actual value numeric value and then removes the numeric value from the group means and so now the group means are adjusted based upon the effect the covariate is having. So we get SPSS and we actually look at the outputs you’ll see the group means will be designated as the adjusted group means. In other words, group means have been changed by a certain amount and the amount is the effect the covariate is actually having on the outcome. So that how it works.
  2. The effect of covariates should be same between treatment groups
  3. CLASS declares qualitative variables that create indicator variables in design matrices MODEL specifies dependent variable and fixed effects, setting up X LSMEANS computes least squares means for classification fixed effects <DIFF computes differences of the least squares means, ADJUST= performs multiple comparisons adjustments, CL produces confidence limits>