3.3.1 Estimating the Width of a Room Revised
The unconditional analysis of the room width estimated by two groups ofstudents in Chapter ?? lead to the conclusion that the estimates in metres areslightly larger than the estimates in feet. Here, we reanalyse these data in aconditional framework. First, we convert metres into feet and store the vectorof observations in a variable y:
R> data("roomwidth", package = "HSAUR")R> convert <- ifelse(roomwidth$unit == "feet", 1, 3.28)R> feet <- roomwidth$unit == "feet"R> metre <- !feetR> y <- roomwidth$width * convert
The test statistic is simply the difference in means
R> T <- mean(y[feet]) - mean(y[metre])R> T
In order to approximate the conditional distribution of the test statistic Twe compute 9999 test statistics for shuffled y values. A permutation of the yvector can be obtained from the sample function.
R> meandiffs <- double(9999)R> for (i in 1:length(meandiffs)) {+
meandiffs[i] <- mean(sy[feet]) - mean(sy[metre])
The distribution of the test statistic T under the null hypothesis of indepen-dence of room width estimates and groups is depicted in Figure Now, thevalue of the test statistic T for the original unshuffled data can be compared
R> hist(meandiffs)R> abline(v = T, lty = 2)R> abline(v = -T, lty = 2)
Histogram of meandiffs
Approximated conditional distribution of the difference of meanroomwidth estimates in the feet and metres group under the null hy-pothesis. The vertical lines show the negative and positive absolutevalue of the test statistic T obtained from the original data.
with the distribution of T under the null hypothesis (the vertical lines in Fig-ure . The p-value, i.e., the proportion of test statistics T larger than 8.859or smaller than -8.859 is
R> greater <- abs(meandiffs) > abs(T)R> mean(greater)
R> binom.test(sum(greater), length(greater))$conf.int
Note that the approximated conditional p-value is roughly the same as thep-value reported by the t-test in Chapter ??.
R> library("coin")R> independence_test(y ~ unit, data = roomwidth, distribution = "exact")
R output of the exact permutation test applied to the roomwidth data.
R> wilcox_test(y ~ unit, data = roomwidth, distribution = "exact")
Exact Wilcoxon Mann-Whitney Rank Sum Testalternative hypothesis: true mu is not equal to 0
R output of the exact conditional Wilcoxon rank sum test applied tothe roomwidth data.
Here we are interested in the comparison of two groups of patients, where onegroup received a placebo and the other one Misoprostol. In the trials shownhere, the response variable is measured on an ordered scale – see Table ??. Data from four clinical studies are available and thus the observations arenaturally grouped together. From the data.frame Lanza we can construct athree-way table as follows:
R> data("Lanza", package = "HSAUR")R> xtabs(~treatment + classification + study, data = Lanza)
R> data("suicides", package = "HSAUR")R> fisher.test(suicides)
Fisher's Exact Test for Count Dataalternative hypothesis: true odds ratio is not equal to 1
R output of Fisher’s exact test for the suicides data.
For the first study, the null hypothesis of independence of treatment andgastrointestinal damage, i.e., of no treatment effect of Misoprostol, is testedby
R> library("coin")R> cmh_test(classification ~ treatment, data = Lanza,
scores = list(classification = c(0, 1, 6, 17,
30)), subset = Lanza$study == "I")
Asymptotic Linear-by-Linear Association Testclassification (ordered) by groups Misoprostol, Placebochi-squared = 28.8478, df = 1, p-value = 7.83e-08
and, by default, the conditional distribution is approximated by the corre-sponding limiting distribution. The p-value indicates a strong treatment effect. For the second study, the asymptotic p-value is a little bit larger
R> cmh_test(classification ~ treatment, data = Lanza,+
scores = list(classification = c(0, 1, 6, 17,
30)), subset = Lanza$study == "II")
Asymptotic Linear-by-Linear Association Testclassification (ordered) by groups Misoprostol, Placebochi-squared = 12.0641, df = 1, p-value = 0.000514
and we make sure that the implied decision is correct by calculating a confi-dence interval for the exact p-value
R> p <- cmh_test(classification ~ treatment, data = Lanza,+
scores = list(classification = c(0, 1, 6, 17,
30)), subset = Lanza$study == "II", distribution = approximate(B = 19999))
The third and fourth study indicate a strong treatment effect as well
R> cmh_test(classification ~ treatment, data = Lanza,+
scores = list(classification = c(0, 1, 6, 17,
30)), subset = Lanza$study == "III")
Asymptotic Linear-by-Linear Association Testclassification (ordered) by groups Misoprostol, Placebochi-squared = 28.1587, df = 1, p-value = 1.118e-07
R> cmh_test(classification ~ treatment, data = Lanza,+
scores = list(classification = c(0, 1, 6, 17,
30)), subset = Lanza$study == "IV")
Asymptotic Linear-by-Linear Association Testclassification (ordered) by groups Misoprostol, Placebochi-squared = 15.7414, df = 1, p-value = 7.262e-05
At the end, a separate analysis for each study is unsatisfactory. Because thedesign of the four studies is the same, we can use study as a block variable
and perform a global linear-association test investigating the treatment effectof Misoprostol in all four studies. The block variable can be incorporated intothe formula by the | symbol.
R> cmh_test(classification ~ treatment | study, data = Lanza,+
scores = list(classification = c(0, 1, 6, 17,
Asymptotic Linear-by-Linear Association Testchi-squared = 83.6188, df = 1, p-value < 2.2e-16
Based on this result, a strong treatment effect can be established.
In this example, the medical doctor (MD) and the research assistant (RA)assessed the number of anomalies (0, 1, 2 or 3) for each of 395 babies:
R> anomalies <- as.table(matrix(c(235, 23, 3, 0, 41,+
35, 8, 0, 20, 11, 11, 1, 2, 1, 3, 1), ncol = 4,
We are interested in testing whether the number of anomalies assessed by themedical doctor differs structurally from the number reported by the researchassistant. Because we compare paired observations, i.e., one pair of measure-ments for each newborn, a test of marginal homogeneity (a generalisation ofMcNemar’s test, see Chapter ??) needs to be applied:
Asymptotic Marginal-Homogeneity Testchi-squared = 21.2266, df = 3, p-value = 9.446e-05
The p-value indicates a deviation from the null hypothesis. However, the levelsof the response are not treated as ordered. Similar to the analysis of thegastrointestinal damage data above, we can take this information into accountby the definition of an appropriate score. Here, the number of anomalies is anatural choice:
R> mh_test(anomalies, scores = list(c(0, 1, 2, 3)))
Asymptotic Marginal-Homogeneity Test for Ordered Datachi-squared = 21.0199, df = 1, p-value = 4.545e-06
In our case, both versions coincide and one can conclude that the assessment ofthe number of anomalies differs between the medical doctor and the researchassistant.
IV ENCUENTRO INTERNACIONAL DE HISTORIA DE LA PRENSA EN IBEROAMÉRICA “La investigación hemerográfica como paradigma de interdisciplinariedad” TÍTULO: LA INFANCIA A EXAMEN. LA REVISTA ‘LA INFANCIA ANORMAL’. AUTORES María Concepción Martínez Omaña. Institución de adscripción: Instituto de Investigaciones Dr. José Ma. Luis Mora. Investigadora Titular “C”. Correo Ele
CURRICULUM VITAE DADOS PESSOAIS Nome: Raúl Manuel Araújo Portugal de Guichard Alves Nacionalidade: Portuguesa Data de nascimento: 4 de Setembro de 1961 (Sé, Porto) Filiação: Noémia Augusta de Araújo Alves Portugal Guichard Raúl Ferreira Guichard de Oliveira Alves Estado civil: casado Residência: Largo do Capitão Pinheiro Torres Meireles, 47 4150-619 E-mail: raulguichard