<?xml version="1.0" encoding="utf-8"?><!DOCTYPE article  PUBLIC '-//OASIS//DTD DocBook XML V4.4//EN'  'http://www.docbook.org/xml/4.4/docbookx.dtd'><article><articleinfo><title>FAQ/Rpvs</title><revhistory><revision><revnumber>6</revnumber><date>2013-03-08 10:17:41</date><authorinitials>localhost</authorinitials><revremark>converted to 1.6 markup</revremark></revision><revision><revnumber>5</revnumber><date>2012-08-30 08:48:47</date><authorinitials>PeterWatson</authorinitials></revision><revision><revnumber>4</revnumber><date>2012-08-23 16:00:14</date><authorinitials>PeterWatson</authorinitials></revision><revision><revnumber>3</revnumber><date>2012-08-23 15:59:54</date><authorinitials>PeterWatson</authorinitials></revision><revision><revnumber>2</revnumber><date>2012-08-23 15:58:45</date><authorinitials>PeterWatson</authorinitials></revision><revision><revnumber>1</revnumber><date>2007-10-10 14:18:15</date><authorinitials>PeterWatson</authorinitials></revision></revhistory></articleinfo><section><title>R syntax for computing adjusted p-values</title><para>In addition to the code below see also the padjust function in R of form </para><screen><![CDATA[p.adjust(p, method = p.adjust.methods, n = length(p))]]></screen><para>for example </para><screen><![CDATA[p <- c(0.01,0.04)
p.adjust(p,method="fdr",n=2)]]></screen><para>which adjusts a set of p-values for a variety of methods including Bonferroni, Hochberg and Holm. </para><para>[ JUST CUT AND PASTE AT THE R PROMPT AFTER ADJUSTING INPUTS AS REQUIRED] </para><para><emphasis role="underline">Sidak and Holm</emphasis> </para><para>This is a stepwise approach which produces the two cutoffs using the Sidak and Holm tests respectively. Only p-values equal or below the cutoff value are statistically significant at alpha=alp when adjusted for the number of p-values entered. </para><para>Input p-values in p and Type I error as alp.  </para><screen><![CDATA[p <- c(0.1,0.2,0.002)
]]><![CDATA[
alp <- 0.05
]]><![CDATA[
pos <- rank(p)
ps <- sort(p)
ncomp <- length(ps)
]]><![CDATA[
dsidak <- 1 - ((1 - ps)**(ncomp-pos+1))
]]><![CDATA[
j.alpha <- rep(alp,length(p))
diff <- dsidak - j.alpha
neg.diff <- diff[diff < 0]
pos.diff <- neg.diff[length(neg.diff)]
index <- diff == pos.diff
p.cutoff <- ps[index]
print(p.cutoff)
p.sig <- p[p <= p.cutoff]
]]><![CDATA[
holm <- (ncomp - pos + 1)*ps
]]><![CDATA[
j.alpha <- rep(alp,length(p))
diff <- holm - j.alpha
neg.diff <- diff[diff < 0]
pos.diff <- neg.diff[length(neg.diff)]
index <- diff == pos.diff
p.cutoff <- ps[index]
print(p.cutoff)
p.sig <- p[p <= p.cutoff]  ]]></screen><para><emphasis role="underline">Ryan and Einot-Gabriel</emphasis> </para><para>Input p-values in p, Type I error as alp and the two differenced groups in  g1 and g2. The adjusted p-values are outputted using the ryan and einot-gabriel methods respectively. </para><screen><![CDATA[p <- c(0.1,0.2,0.002)
]]><![CDATA[
alp <- 0.05
]]><![CDATA[
g1 <- c(1,1,2)
g2 <- c(2,3,3)
]]><![CDATA[
ncomp <- length(p)
]]><![CDATA[
step <- abs(g2-g1)+1
ryan <- p*(ncomp/step)
eingab <- 1 - ( (1 - p)**(ncomp/step) )
unit <- rep(1,length(p))
]]><![CDATA[
for (i in 1:length(p)) {
if (ryan[i] > unit[i]) ryan[i] = unit[i]
if (eingab[i] > unit[i]) eingab[i] = unit[i]
 }
print(ryan)
print(eingab)]]></screen></section></article>