Table 1
Scores in different performance areas obtained by children aged 16 to 27 months old in a municipality in the interior of São Paulo.
x1=c(25,60,50,50,40,45,55,60,50,40,60)
x2=c(50,55,50,60,50,35,60,60,60,50,55)
x3=c(20,30,50,40,30,40,55,50,55,45,50)
x4=c(35,40,45,60,50,45,60,50,60,30,60)
x5=c(30,60,40,45,50,25,40,40,45,60,60)
y1=c(25,60,55,55,60,60,55,60,55,60)
y2=c(60,60,55,55,60,60,60,15,60,55)
y3=c(55,40,30,30,55,60,45,60,60,50)
y4=c(50,35,40,55,55,50,50,50,60,60)
y5=c(50,50,50,60,60,55,50,60,60,45)
#Boys Communication Group 16-27 months old
#Girls Communication Group 16-27 months old
dados=read.csv(“D:/dados.csv”,header = TRUE, sep=”;”)
> dados
Communication CM.Wide CM.Fine Gender
1 25 50 20 1
2 60 55 30 1
....
21 60 55 50 0
t1=data$Communication
> t1
[1] 25 60 50 50 40 45 55 60 50 40 60 25 60 55 55 60 60 55 60 55 60
x1=data$Communication[data$Gender==1]
y1=data$Communication[data$Gender==0]
> x1
[1] 25 60 50 50 40 45 55 60 50 40 60
> y1
[1] 25 60 55 55 60 60 55 60 55 60
mean(x1)
[1] 48.63636
var(x1)
[1] 115.4545
sd(x1)
[1] 10.74498
summary(x1)
Min. 1st Qu. Median Mean 3rd Qu. Max.
25.00 42.50 50.00 48.64 57.50 60.00
#Left Figure
hist(x1)
#Right Figure
hist(x1,main=”Communication Group 16-27 months old”,xlab =”Score”, ylab=”Frequency”,
col=”deepskyblue4”)
#Left Figure
boxplot(x3,y3)
#Right Figure
boxplot(x3,y3,col=c(”deepskyblue4”,”gray70”), main=”Boxplot for
Fine Motor Coordination”, names=c(”Male”, “Female”), ylab=”Score”,
horizontal=FALSE)
pie(c(length(x1),length(y1)))
pie(c(length(x1),length(y1)), col=c(“deepskyblue4”,”gray70”),
labels=c(”Male”, “Female “), main=” Gender “)
pie(c(sum(data$Gender),length(data$Gender)-sum(data$Gedner)))
pie (c(sum(data$Gender),length(data$Gender)-sum(data$Gender)), col=c(”deepskyblue4”,
“gray70”),labels=c(”Male”, “Female”), main=”Gender”)
barplot(c(length(x1),length(y1)), main=” Number of students divided by gender”, col=c(”deepskyblue4”,”gray70”),
names.arg=c(”Male”, “Female”))
ta1<-function(alpha,E,N=NA,p=0.5){
z<-qnorm(1-alpha/2,0,1)
if(is.na(N)) { n<-(z*sqrt(p*(1-p))/E)^2 } else {
n<-(N*p*(1-p)*(z^2))/(((N-1)*(E^2))+(p*(1-p)*(z^2))) }
return(round(n))}
ta1(alpha=0.05,E=0.03)
[1] 1067
ta1(0.05,0.03,0.06)
[1] 241
ta1(0.05,0.03,1000)
[1] 516
ta1(0.05,0.03,1000,0.06)
[1] 194
#Function for quantitative data
ta2<-function(alpha,E,sigma,N=NA){
z<-qnorm(1-alpha/2,0,1)
if(is.na(N)) { n<-(z*sigma/(100*E))^2 } else {
n<-(N*(sigma^2)*(z^2))/(((N-1)*((100*E)^2))+(sigma^2*(z^2))) }
return(round(n))}
ta2(0.05,0.02,11.77,4000)
[1] 129
ta2(0.05,0.02, 11.77,30000)
[1] 132
ta2(0.05,0.02, 11.77)
[1] 133
>shapiro.test(x3)
Shapiro-Wilk normality test
data: x3
W = 0.905, p-value = 0.2125
>shapiro.test(y3)
Shapiro-Wilk normality test
data: y3
W = 0.85874, p-value = 0.07374
>var.test(x3,y3,conf.level = 0.95)
F test to compare two variances
data: x3 and y3
F = 0.9472, numdf = 10, denomdf = 9, p-value = 0.926
alternative hypothesis: true ratio of variances is not equal to 1
t.test(x, y, paired = FALSE, var.equal=FALSE, conf.level = 0.95)
t.test(x3,y3, paired = FALSE, var.equal = TRUE, conf.level = 0.95)
Two Sample t-test
data: x3 and y3
t = -1.2236, df = 18.696, p-value = 0.2363
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:-16.890851 4.436305
t.test(x5,y5, paired = FALSE, var.equal = TRUE, conf.level = 0.95)
Two Sample t-test
data: x5 and y5
t = -2.2536, df = 14.66, p-value = 0.03999
alternative hypothesis: true difference in means is not equal to 0
shapiro.test(y5)
Shapiro-Wilk normality test
data: y5
W = 0.82495, p-value = 0.02909
wilcox.test(x, y, paired = FALSE, conf.level = 0.95)
wilcox.test(x5,y5,paired = FALSE, exact=FALSE, conf.level = 0.95)
Wilcoxon rank sum test with continuity correction
data: x5 and y5
W = 28, p-value = 0.05497
alternative hypothesis: true location shift is not equal to 0
#Relationship between communication and motor coordination variables for boys
>cor(x1,x2)
[1] 0.462047
#Relationship in the variables communication and fine motor coordination for boys
>cor(x1,x3)
[1] 0.6153194
cor.test(x,y,conf.level = 0.95)
cor.test(x2,x3)
Pearson’s product-moment correlation
data: x1 and x2
t = 1.563, df = 9, p-value = 0.1525
alternative hypothesis: true correlation is not equal to 0
sample estimates: cor 0.462047
cor.test(x1,x3)
Pearson’s product-moment correlation
data: x1 and x3
t = 2.3418, df = 9, p-value = 0.0439
alternative hypothesis: true correlation is not equal to 0
Sample estimates: cor 0.615319