SlideShare a Scribd company logo
1 of 6
Complete Randomized Experimental
Design using R script
Dr. D. Dutta Roy
Psychology Research Unit
Indian Statistical Institute
Hypothetical data
• a1=1:10
• a2=5:14
• a3=10:19
• a4=data.frame(a1=1:5,a2=5:14,a3=10:19)
• a4
• summary(a4)
• a5=stack(a4)
• a5
• boxplot(a4, main="Systematic variation across three training
groups", ylab="Score",xlab="Training groups",col=c(2:4))
• colnames(a4)=c("Theory","Practical","Theory and practical")
• a6=aov(a5$values~a5$ind)
• summary(a6)
• tapply(a5$values,a5$ind,mean)
• tapply(a5$values,a5$ind,sd)
Fitted data and residual
• paste(a5$values)
• paste(a6$fitted.values)
• paste(a6$residuals)
Multiple Range test
• TukeyHSD(a6)
• plot(TukeyHSD(a6))
• kruskal.test(a5$values~a5$ind)
• barplot(tapply(a5$values,a5$ind,mean))
Assumptions
• dependent variable should be measured at the continuous level
(i.e., they are interval or ratio variables).
• two independent variables should each consist of two or more
categorical, independent groups.
• You should have independence of observations, which means that
there is no relationship between the observations in each group or
between the groups themselves.
• There should be no significant outliers.
• Your dependent variable should be approximately normally
distributed for each combination of the groups of the two
independent variables.
• There needs to be homogeneity of variances for each combination
of the groups of the two independent variables.

More Related Content

Similar to Crd with r script

Text classification
Text classificationText classification
Text classification
Fraboni Ec
 
Text classification
Text classificationText classification
Text classification
David Hoen
 
Text classification
Text classificationText classification
Text classification
James Wong
 
Text classification
Text classificationText classification
Text classification
Tony Nguyen
 
R is a very flexible and powerful programming language, as well as a.pdf
R is a very flexible and powerful programming language, as well as a.pdfR is a very flexible and powerful programming language, as well as a.pdf
R is a very flexible and powerful programming language, as well as a.pdf
annikasarees
 
Introduction to Perl
Introduction to PerlIntroduction to Perl
Introduction to Perl
Sway Wang
 

Similar to Crd with r script (19)

Arrays
ArraysArrays
Arrays
 
Joclad 2010 d
Joclad 2010 dJoclad 2010 d
Joclad 2010 d
 
Text classification
Text classificationText classification
Text classification
 
Text classification
Text classificationText classification
Text classification
 
Text classification
Text classificationText classification
Text classification
 
Text classification
Text classificationText classification
Text classification
 
Text classification
Text classificationText classification
Text classification
 
Text classification
Text classificationText classification
Text classification
 
Text classification
Text classificationText classification
Text classification
 
06 1 조건문
06 1 조건문06 1 조건문
06 1 조건문
 
R is a very flexible and powerful programming language, as well as a.pdf
R is a very flexible and powerful programming language, as well as a.pdfR is a very flexible and powerful programming language, as well as a.pdf
R is a very flexible and powerful programming language, as well as a.pdf
 
Data science - Handling Outliers
Data science  - Handling OutliersData science  - Handling Outliers
Data science - Handling Outliers
 
r studio presentation.pptx
r studio presentation.pptxr studio presentation.pptx
r studio presentation.pptx
 
r studio presentation.pptx
r studio presentation.pptxr studio presentation.pptx
r studio presentation.pptx
 
Statistics Assignment Help
Statistics Assignment HelpStatistics Assignment Help
Statistics Assignment Help
 
Introduction to Perl
Introduction to PerlIntroduction to Perl
Introduction to Perl
 
my$talk=qr{((?:ir)?reg(?:ular )?exp(?:ressions?)?)}i;
my$talk=qr{((?:ir)?reg(?:ular )?exp(?:ressions?)?)}i;my$talk=qr{((?:ir)?reg(?:ular )?exp(?:ressions?)?)}i;
my$talk=qr{((?:ir)?reg(?:ular )?exp(?:ressions?)?)}i;
 
Intoduction to numpy
Intoduction to numpyIntoduction to numpy
Intoduction to numpy
 
CBSE XII COMPUTER SCIENCE STUDY MATERIAL BY KVS
CBSE XII COMPUTER SCIENCE STUDY MATERIAL BY KVSCBSE XII COMPUTER SCIENCE STUDY MATERIAL BY KVS
CBSE XII COMPUTER SCIENCE STUDY MATERIAL BY KVS
 

More from Dr. Debdulal Dutta Roy (7)

Human resource management in educational institute
Human resource management in educational instituteHuman resource management in educational institute
Human resource management in educational institute
 
Atari self efficacy in technology adoption
Atari self efficacy in technology adoptionAtari self efficacy in technology adoption
Atari self efficacy in technology adoption
 
Crd with r script
Crd with r scriptCrd with r script
Crd with r script
 
Life skills and Self-Development
Life skills and Self-DevelopmentLife skills and Self-Development
Life skills and Self-Development
 
Rabindrik approach in school counselling
Rabindrik approach in school counsellingRabindrik approach in school counselling
Rabindrik approach in school counselling
 
Noida rabindrik psychotherapy
Noida rabindrik psychotherapyNoida rabindrik psychotherapy
Noida rabindrik psychotherapy
 
What is Questionnaire ? Lecture for Doctoral fellows in Management
What is Questionnaire ? Lecture for Doctoral fellows in ManagementWhat is Questionnaire ? Lecture for Doctoral fellows in Management
What is Questionnaire ? Lecture for Doctoral fellows in Management
 

Recently uploaded

Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
EADTU
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
EADTU
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
AnaAcapella
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
中 央社
 

Recently uploaded (20)

Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
 
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................
 
VAMOS CUIDAR DO NOSSO PLANETA! .
VAMOS CUIDAR DO NOSSO PLANETA!                    .VAMOS CUIDAR DO NOSSO PLANETA!                    .
VAMOS CUIDAR DO NOSSO PLANETA! .
 
Book Review of Run For Your Life Powerpoint
Book Review of Run For Your Life PowerpointBook Review of Run For Your Life Powerpoint
Book Review of Run For Your Life Powerpoint
 
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community PartnershipsSpring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
 
Supporting Newcomer Multilingual Learners
Supporting Newcomer  Multilingual LearnersSupporting Newcomer  Multilingual Learners
Supporting Newcomer Multilingual Learners
 
e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopal
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxAnalyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptx
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in Hinduism
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....
 

Crd with r script

  • 1. Complete Randomized Experimental Design using R script Dr. D. Dutta Roy Psychology Research Unit Indian Statistical Institute
  • 2. Hypothetical data • a1=1:10 • a2=5:14 • a3=10:19 • a4=data.frame(a1=1:5,a2=5:14,a3=10:19) • a4 • summary(a4) • a5=stack(a4) • a5 • boxplot(a4, main="Systematic variation across three training groups", ylab="Score",xlab="Training groups",col=c(2:4)) • colnames(a4)=c("Theory","Practical","Theory and practical")
  • 3. • a6=aov(a5$values~a5$ind) • summary(a6) • tapply(a5$values,a5$ind,mean) • tapply(a5$values,a5$ind,sd)
  • 4. Fitted data and residual • paste(a5$values) • paste(a6$fitted.values) • paste(a6$residuals)
  • 5. Multiple Range test • TukeyHSD(a6) • plot(TukeyHSD(a6)) • kruskal.test(a5$values~a5$ind) • barplot(tapply(a5$values,a5$ind,mean))
  • 6. Assumptions • dependent variable should be measured at the continuous level (i.e., they are interval or ratio variables). • two independent variables should each consist of two or more categorical, independent groups. • You should have independence of observations, which means that there is no relationship between the observations in each group or between the groups themselves. • There should be no significant outliers. • Your dependent variable should be approximately normally distributed for each combination of the groups of the two independent variables. • There needs to be homogeneity of variances for each combination of the groups of the two independent variables.