# Criando testes usando randomizações. m = c(120,107,110,116,114,111,113,117,114,112) > f = c(110,111,107,108,110,105,107,106,111,111) boxplot(m,f, names.

## Presentation on theme: "Criando testes usando randomizações. m = c(120,107,110,116,114,111,113,117,114,112) > f = c(110,111,107,108,110,105,107,106,111,111) boxplot(m,f, names."— Presentation transcript:

Criando testes usando randomizações

m = c(120,107,110,116,114,111,113,117,114,112) > f = c(110,111,107,108,110,105,107,106,111,111) boxplot(m,f, names = c("machos", "fêmeas"))

require(boot) media = function(x,i)mean(x[i]) bootm = boot(m, media, 1000)

plot (bootm)

> names(bootm) [1] "t0" "t" "R" "data" "seed" "statistic" [7] "sim" "call" "stype" "strata" "weights"

hist(bootm\$t, xlab =NULL, main = NULL )

hist(bootm\$t, xlab ="comprimento do crânio", ylab = "freqüência",main = "Machos", freq = F ) > curve (dnorm(x, mean = 113.4, sd=3.7178),lwd = 3, add = T)

cranio = data.frame(m,f) > cranio m f 1 120 110 2 107 111 3 110 107 4 116 108 5 114 110 6 111 105 7 113 107 8 117 106 9 114 111 10 112 111

dmf = function (x,i)mean(cranio\$m[i])-mean(cranio\$f[i]) > bootdmf= boot(cranio,dmf, 1000) > boxplot (bootdmf\$t, ylab= "diferença de comprimentos")

hist(bootdmf\$t, xlab ="diferença de comprimento do crânio", main = NULL, freq = F ) curve (dnorm(x, mean = 4.8, sd=1.329), add = T) curve (dnorm(x, mean = 0, sd=1.329), lwd = 3, col = 2, add = T, pch = 4)

bootdmf ORDINARY NONPARAMETRIC BOOTSTRAP Call: boot(data = cranio, statistic = dmf, R = 1000) Bootstrap Statistics : original bias std. error t1* 4.8 -0.0274 1.329382

pmf = function (x,i)mean(cranio\$m[i])/mean(cranio\$f[i]) > bootpmf= boot(cranio,pmf, 1000) > bootpmf ORDINARY NONPARAMETRIC BOOTSTRAP Call: boot(data = cranio, statistic = pmf, R = 1000) Bootstrap Statistics : original bias std. error t1* 1.044199 -0.0002888062 0.01231848

quantile(bootpmf\$t, c(0.01, 0.99)) 1% 99% 1.013604 1.071238 > min(bootpmf\$t) [1] 1.00271

hist(bootpmf\$t, xlab ="índice de comprimento m/f", main = NULL, freq = F ) > curve (dnorm(x, mean = 1, sd=0.01231848), add = T)

> hist(bootpmf\$t, xlab ="índice de comprimento m/f",ylab = "densidade", main = NULL, freq = F ) > curve (dnorm(x, mean = 1, sd=0.01231848), lwd = 2, col = 3,add = T) > curve (dnorm(x, mean = 1.044199, sd=0.01231848), lwd = 2, col = 1,add = T)

Download ppt "Criando testes usando randomizações. m = c(120,107,110,116,114,111,113,117,114,112) > f = c(110,111,107,108,110,105,107,106,111,111) boxplot(m,f, names."

Similar presentations