1 |
nuhat |
|
C |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (nuhat, C)
{
if (C - round(C) != 0)
stop("The number of contrasts, C, must be an integer")
if (C >= 29)
stop("C must be less than or equal to 28")
if (C <= 0)
stop("C must be greater than or equal to 1")
if (nuhat < 2)
stop("The degrees of freedom must be greater than or equal to 2")
if (C == 1)
smmcrit01 <- qt(0.995, nuhat)
if (C >= 2) {
C <- C - 1
m1 <- matrix(0, 20, 27)
m1[1, ] <- c(12.73, 14.44, 15.65, 16.59, 17.35, 17.99,
18.53, 19.01, 19.43, 19.81, 20.15, 20.46, 20.75,
20.99, 20.99, 20.99, 20.99, 20.99, 22.11, 22.29,
22.46, 22.63, 22.78, 22.93, 23.08, 23.21, 23.35)
m1[2, ] <- c(7.13, 7.91, 8.48, 8.92, 9.28, 9.58, 9.84,
10.06, 10.27, 10.45, 10.61, 10.76, 10.9, 11.03, 11.15,
11.26, 11.37, 11.47, 11.56, 11.65, 11.74, 11.82,
11.89, 11.97, 12.07, 12.11, 12.17)
m1[3, ] <- c(5.46, 5.99, 6.36, 6.66, 6.89, 7.09, 7.27,
7.43, 7.57, 7.69, 7.8, 7.91, 8.01, 8.09, 8.17, 8.25,
8.32, 8.39, 8.45, 8.51, 8.57, 8.63, 8.68, 8.73, 8.78,
8.83, 8.87)
m1[4, ] <- c(4.7, 5.11, 5.39, 5.63, 5.81, 5.97, 6.11,
6.23, 6.33, 6.43, 6.52, 6.59, 6.67, 6.74, 6.81, 6.87,
6.93, 6.98, 7.03, 7.08, 7.13, 7.17, 7.21, 7.25, 7.29,
7.33, 7.36)
m1[5, ] <- c(4.27, 4.61, 4.85, 5.05, 5.2, 5.33, 5.45,
5.55, 5.64, 5.72, 5.79, 5.86, 5.93, 5.99, 6.04, 6.09,
6.14, 6.18, 6.23, 6.27, 6.31, 6.34, 6.38, 6.41, 6.45,
6.48, 6.51)
m1[6, ] <- c(3.99, 4.29, 4.51, 4.68, 4.81, 4.93, 5.03,
5.12, 5.19, 5.27, 5.33, 5.39, 5.45, 5.5, 5.55, 5.59,
5.64, 5.68, 5.72, 5.75, 5.79, 5.82, 5.85, 5.88, 5.91,
5.94, 5.96)
m1[7, ] <- c(3.81, 4.08, 4.27, 4.42, 4.55, 4.65, 4.74,
4.82, 4.89, 4.96, 5.02, 5.07, 5.12, 5.17, 5.21, 5.25,
5.29, 5.33, 5.36, 5.39, 5.43, 5.45, 5.48, 5.51, 5.54,
5.56, 5.59)
m1[8, ] <- c(3.67, 3.92, 4.1, 4.24, 4.35, 4.45, 4.53,
4.61, 4.67, 4.73, 4.79, 4.84, 4.88, 4.92, 4.96, 5.01,
5.04, 5.07, 5.1, 5.13, 5.16, 5.19, 5.21, 5.24, 5.26,
5.29, 5.31)
m1[9, ] <- c(3.57, 3.8, 3.97, 4.09, 4.2, 4.29, 4.37,
4.44, 4.5, 4.56, 4.61, 4.66, 4.69, 4.74, 4.78, 4.81,
4.84, 4.88, 4.91, 4.93, 4.96, 4.99, 5.01, 5.03, 5.06,
5.08, 5.09)
m1[10, ] <- c(3.48, 3.71, 3.87, 3.99, 4.09, 4.17, 4.25,
4.31, 4.37, 4.42, 4.47, 4.51, 4.55, 4.59, 4.63, 4.66,
4.69, 4.72, 4.75, 4.78, 4.8, 4.83, 4.85, 4.87, 4.89,
4.91, 4.93)
m1[11, ] <- c(3.42, 3.63, 3.78, 3.89, 0.99, 4.08, 4.15,
4.21, 4.26, 4.31, 4.36, 4.4, 4.44, 4.48, 4.51, 4.54,
4.57, 4.59, 4.62, 4.65, 4.67, 4.69, 4.72, 4.74, 4.76,
4.78, 4.79)
m1[12, ] <- c(3.32, 3.52, 3.66, 3.77, 3.85, 3.93, 3.99,
0.05, 4.1, 4.15, 4.19, 4.23, 4.26, 4.29, 4.33, 4.36,
4.39, 4.41, 4.44, 4.46, 4.48, 4.5, 4.52, 4.54, 4.56,
4.58, 4.59)
m1[13, ] <- c(3.25, 3.43, 3.57, 3.67, 3.75, 3.82, 3.88,
3.94, 3.99, 4.03, 4.07, 4.11, 4.14, 4.17, 4.19, 4.23,
4.25, 4.28, 4.29, 4.32, 4.34, 4.36, 4.38, 4.39, 4.42,
4.43, 4.45)
m1[14, ] <- c(3.19, 3.37, 3.49, 3.59, 3.68, 3.74, 3.8,
3.85, 3.89, 3.94, 3.98, 4.01, 4.04, 4.07, 4.1, 4.13,
4.15, 4.18, 4.19, 4.22, 4.24, 4.26, 4.28, 4.29, 4.31,
4.33, 4.34)
m1[15, ] <- c(3.15, 3.32, 3.45, 3.54, 3.62, 3.68, 3.74,
3.79, 3.83, 3.87, 3.91, 3.94, 3.97, 3.99, 4.03, 4.05,
4.07, 4.09, 4.12, 4.14, 4.16, 4.17, 4.19, 4.21, 4.22,
4.24, 4.25)
m1[16, ] <- c(3.09, 3.25, 3.37, 3.46, 3.53, 3.59, 3.64,
3.69, 3.73, 3.77, 3.8, 3.83, 3.86, 3.89, 3.91, 3.94,
3.96, 3.98, 4, 4.02, 4.04, 4.05, 4.07, 4.09, 4.1,
4.12, 4.13)
m1[17, ] <- c(3.03, 3.18, 3.29, 3.38, 3.45, 3.5, 3.55,
3.59, 3.64, 3.67, 3.7, 3.73, 3.76, 3.78, 3.81, 3.83,
3.85, 3.87, 3.89, 3.91, 3.92, 3.94, 3.95, 3.97, 3.98,
4, 4.01)
m1[18, ] <- c(2.97, 3.12, 3.22, 3.3, 3.37, 3.42, 3.47,
3.51, 3.55, 3.58, 3.61, 3.64, 3.66, 3.68, 3.71, 3.73,
3.75, 3.76, 3.78, 3.8, 3.81, 3.83, 3.84, 3.85, 3.87,
3.88, 3.89)
m1[19, ] <- c(2.91, 3.06, 3.15, 3.23, 3.29, 3.34, 3.38,
3.42, 3.46, 3.49, 3.51, 3.54, 3.56, 3.59, 3.61, 3.63,
3.64, 3.66, 3.68, 3.69, 3.71, 3.72, 3.73, 3.75, 3.76,
3.77, 3.78)
m1[20, ] <- c(2.81, 2.93, 3.02, 3.09, 3.14, 3.19, 3.23,
3.26, 3.29, 3.32, 3.34, 3.36, 3.38, 3.4, 0.42, 0.44,
3.45, 3.47, 3.48, 3.49, 3.5, 3.52, 3.53, 3.54, 3.55,
3.56, 3.57)
if (nuhat >= 200)
smmcrit01 <- m1[20, C]
if (nuhat < 200) {
nu <- c(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16,
18, 20, 24, 30, 40, 60, 200)
temp <- abs(nu - nuhat)
find <- order(temp)
if (temp[find[1]] == 0)
smmcrit01 <- m1[find[1], C]
if (temp[find[1]] != 0) {
if (nuhat > nu[find[1]]) {
smmcrit01 <- m1[find[1], C] - (1/nu[find[1]] -
1/nuhat) * (m1[find[1], C] - m1[find[1] +
1, C])/(1/nu[find[1]] - 1/nu[find[1] + 1])
}
if (nuhat < nu[find[1]]) {
smmcrit01 <- m1[find[1] - 1, C] - (1/nu[find[1] -
1] - 1/nuhat) * (m1[find[1] - 1, C] - m1[find[1],
C])/(1/nu[find[1] - 1] - 1/nu[find[1]])
}
}
}
}
smmcrit01
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.