Estimates & Confidence Intervals

advertisement
Study over all material since the last exam, including the material on R functions that we have covered. A
lot of this material is on confidence intervals and tests of hypotheses. On tis cheat sheet I have summarized this
material in a simple table form.
Estimates & Confidence Intervals
Recall that a (1−α)100% confidence interval for a paremter traps the true parameter (1−α)100% of the time. Table
0.1 displays the estimates and confidence intervals that we have considered so far. Note that the R-code for each
is given. The CI and estimate can be saved. For example, f it = t.test(x), est = f it$est and vecci = f it$conf.int.
Table 0.1: Table of Estimates and Confidence Intervals (so far). Note that IS stands for independent samples and
PS stands for paired samples.
µ
Sample(s)
Estimate
CI
R-code
x= c(x1 , . . . , xn )
x
x ± tα/2,n−1 √sn
t.test(x)
Based on WA’s
q
p̂ ± zα/2 p̂q̂
n
wilcox.test(x,conf.int=TRUE)
x−y
x − y ± tα/2,n1 +n2 −2 SE
q 2
s
s2
SE = n11 + n22
t.test(x,y)
med{Xi − Yj }
Based on diffs.
wilcox.test(x,y,conf.int=TRUE)
d
d ± tα/2,n−1 √sdn
t.test(d)
Based on WA’s
wilcox.test(d,conf.int=TRUE)
p̂1 − p̂2 ± zα/2 SE
q
SE = p̂n1 q̂11 + p̂n2 q̂22
prop.test(c(S1,S2),c(n1,n2))
p̂1 − p̂2 ± zα/2 SE
q
2
1 −p̂2 )
SE = p̂1 +p̂2 −(p̂
n
Class function
µ
x= c(x1 , . . . , xn )
medi≤j
p
S = #Suc
p̂ =
n
xi +xj
2
o
S
n
prop.test(S,n)
n = samp.size
µ 1 − µ2
x= c(x1 , . . . , xn1 )
IS
y= c(y1 , . . . , yn2 )
µ 1 − µ2
x= c(x1 , . . . , xn1 )
IS
y= c(y1 , . . . , yn2 )
µ 1 − µ2
di = xi − yi
PS
d= c(d1 , . . . , dn )
µ 1 − µ2
di = xi − yi
PS
d= c(d1 , . . . , dn )
p1 − p2
Succ. S1 & S2
p̂1 =
S1
n1
IS
Based on n1 & n2
p̂2 =
S1
n2
p1 − p2
Succ. S1 & S2
p̂1 =
S1
n
PS
Based on n
p̂2 =
S1
n
medi≤j
n
di +dj
2
o
1
Tests
• Level of test = PH0 [Reject H0 ].
• Power of test at θ = Pθ [Reject H0 ].
• p-value of test is the lowest level, based on the data, at which the test rejects H0 .
Tables 0.2 and 0.3 displays the confidence intervals that we have considered so far. Note that the R-code for
each is given.
2
Table 0.2: Table of Tests (so far). Note that IS stands for independent samples and PS stands for paired samples.
µ
Sample(s)
Test Stat
x= c(x1 , . . . , xn )
t=
x−µ
√0
s/ n
Null
Alt
Reject at α
H0 : µ = µ0
HA : µ > µ0
pvalue ≤ α
HA : µ < µ0
pvalue ≤ α
HA : µ 6= µ0
pvalue ≤ α
Rcode: tst = t.test(x, mu = mu0, alternative = c(”greater”, ”less”, ”two.sided”))
P
µ
x= c(x1 , . . . , xn ) T = xi −µ0 >0 R(|xi |) H0 : µ = µ0
HA : µ > µ0
tst$p.value
pvalue ≤ α
HA : µ < µ0
pvalue ≤ α
HA : µ 6= µ0
pvalue ≤ α
Rcode: tst = wilcox.test(x, mu = mu0, alternative = c(”greater”, ”less”, ”two.sided”))
tst$p.value
p
HA : p > p0
pvalue ≤ α
HA : p < p0
pvalue ≤ α
HA : p 6= p0
pvalue ≤ α
S = #Suc
S
H0 : p = p0
n = samp.size
Rcode: tst = prop.test(S, n, p = p0, alternative = c(”greater”, ”less”, ”two.sided”))
µ1 − µ2
t = x−y
SE
q 2
s
SE = n11 +
tst$p.value
HA : µ1 > µ2
pvalue ≤ α
HA : µ1 < µ2
pvalue ≤ α
HA : µ1 6= µ2
pvalue ≤ α
Rcode: tst = t.test(x, y, alternative = c(”greater”, ”less”, ”two.sided”))
P 1
µ1 − µ2 x= c(x1 , . . . , xn1 ) W = ni=1
R(xi )
H0 : µ1 = µ2 HA : µ1 > µ2
tst$p.value
IS
HA : µ1 < µ2
pvalue ≤ α
HA : µ1 6= µ2
pvalue ≤ α
IS
x= c(x1 , . . . , xn1 )
y= c(y1 , . . . , yn2 )
H0 : µ1 = µ2
s22
n2
y= c(y1 , . . . , yn2 )
Rcode: tst = wilcox.test(x, y, alternative = c(”greater”, ”less”, ”two.sided”))
3
pvalue ≤ α
tst$p.value
Table 0.3: Table of Tests (so far). Note that IS stands for independent samples and PS stands for paired samples.
Sample(s)
Test Stat
Null
Alt
Reject at α
µ1 − µ 2
di = xi − yi
t=
H0 : µ1 = µ2
HA : µ1 > µ2
pvalue ≤ α
PS
d= c(d1 , . . . , dn )
HA : µ1 < µ2
pvalue ≤ α
HA : µ1 6= µ2
pvalue ≤ α
Rcode: tst = t.test(d, alternative = c(”greater”, ”less”, ”two.sided”))
P
µ1 − µ2 di = xi − yi
T = di >0 R(|di |) H0 : µ1 = µ2 HA : µ1 > µ2
tst$p.value
PS
HA : µ1 < µ2
pvalue ≤ α
HA : µ1 6= µ2
pvalue ≤ α
d
√
s/ n
d= c(d1 , . . . , dn )
Rcode: tst = wilcox.test(d, alternative = c(”greater”, ”less”, ”two.sided”))
p1 − p2
Succ. S1 & S2
z=
√
pq
ˆ1 −p̂2
p̂q̂ n1 + n1
1
IS
p̂ =
H0 : p1 = p2
HA : p1 > p2
pvalue ≤ α
n1 p1 +n2 p2
n1 +n2
HA : p1 < p2
pvalue ≤ α
HA : p1 6= p2
pvalue ≤ α
Rcode: tst = prop.test(c(S1, S2), c(n1, n2), alternative = c(”greater”, ”less”, ”two.sided”))
Succ. S1 & S2
PS
Based on n
−pˆ2
z = p̂1SE
q
2
SE = p̂1 +p̂
n
tst$p.value
2
q̂ = 1 − p̂
p1 − p2
pvalue ≤ α
H0 : p1 = p2
Rcode: tst = Student Function
tst$p.value
HA : p1 > p2
pvalue ≤ α
HA : p1 < p2
pvalue ≤ α
HA : p1 6= p2
pvalue ≤ α
tst$p.value
4
Download