#' Setup model file for running
#'
#' Finds the standard model file for the specified model, and copies it
#' into the current working directory
#'
#' @param model A character vector (length 1) specifying the model
#' @param examples_dir A character vector (length 1), containing the path to
#' the Examples directory in the MultiBUGS directory
#' @return The full path to the just-created (as a result of copying) file
model_arg <- function(model, examples_dir){
standard_copy_and_return("model", model, examples_dir)
}
#' Set up data file for running
#'
#' Finds the appropriate data files and either copies or loads the data.
#' Simple cases will be copied across. More fiddly examples involve loading
#' the data into R.
#'
#' @inheritParams model_arg
#' @return The full path to the just-created (as a result of copying) file;
#' OR an R object with the data
data_arg <- function(model, examples_dir){
if (model == "Jama") {
data_list1 <- load_data_file(filename = "Jamadata1.txt", examples_dir)
data_list2 <- list(
X = c(3630, 3620, 3560, 3545, 3500, 3030, 2845, 2800, 2500, 2430, 2170,
2125, 1990, 1980, 1960, 1950, 1610, 1590, 1540, 1520, 1480, 1330,
1260, 1240, 1195, 1170, 1120, 1120, 1030, 960, 880, 870, 820, 800,
630, 515, 305),
sigma = c(70, 70, 70, 135, 70, 80, 95, 115, 160, 170, 40, 300, 100, 70,
90, 70, 70, 80, 70, 80, 75, 70, 30, 40, 85, 340, 30, 90, 90,
35, 70, 45, 70, 40, 30, 40, 35),
phase = c(1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4,
4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 7)
)
data_list3 <- list(
calBP = c(0, 10, 30, 50, 70, 90, 110, 125, 140, 160, 180, 200, 220,
240, 260, 280, 300, 320, 340, 360, 380, 400, 420, 440,
460, 480, 490, 500, 520, 540, 560, 580, 600, 620, 640,
660, 675, 690, 705, 720, 738, 758, 780, 800, 820, 840,
860, 880, 900, 920, 940, 960, 980, 998, 1010, 1030, 1050,
1070, 1090, 1100, 1120, 1140, 1160, 1180, 1200, 1220,
1240, 1260, 1280, 1300, 1320, 1340, 1360, 1380, 1400,
1420, 1440, 1460, 1480, 1500, 1520, 1540, 1560, 1580,
1600, 1620, 1640, 1660, 1680, 1700, 1720, 1740, 1760,
1780, 1800, 1820, 1840, 1860, 1880, 1900, 1920, 1940,
1960, 1980, 2000, 2020, 2040, 2060, 2080, 2100, 2120,
2140, 2160, 2180, 2200, 2220, 2240, 2260, 2280, 2300,
2320, 2340, 2360, 2380, 2400, 2420, 2440, 2460, 2480,
2500, 2520, 2540, 2560, 2580, 2600, 2620, 2640, 2660,
2680, 2700, 2720, 2740, 2760, 2780, 2800, 2820, 2840,
2860, 2880, 2900, 2920, 2940, 2960, 2980, 3000, 3020,
3040, 3060, 3070, 3090, 3100, 3120, 3140, 3160, 3180,
3200, 3220, 3240, 3260, 3280, 3300, 3320, 3340, 3360,
3380, 3400, 3420, 3440, 3460, 3480, 3500, 3520, 3540,
3560, 3580, 3600, 3620, 3640, 3660, 3680, 3700, 3720,
3740, 3760, 3780, 3800, 3820, 3840, 3860, 3880, 3900,
3920, 3940, 3960, 3980, 4000, 4020, 4040, 4060, 4080,
4100, 4120, 4140, 4160, 4180, 4200, 4220, 4240, 4260,
4280, 4300, 4320, 4340, 4360, 4380, 4400, 4420, 4440,
4460, 4480, 4500, 4520, 4540, 4560, 4580, 4600, 4620,
4640, 4660, 4680, 4700, 4720, 4740, 4760, 4780, 4800,
4820, 4840, 4860, 4880, 4900, 4920, 4940, 4960, 4980,
5000, 5020, 5040, 5060, 5080, 5100, 5120, 5140, 5160,
5180, 5200, 5220, 5240, 5260, 5280, 5300, 5320, 5340,
5360, 5380, 5400, 5420, 5440, 5460, 5480, 5500, 5520,
5540, 5560, 5580, 5600, 5620, 5640, 5660, 5680, 5700,
5720, 5740, 5760, 5780, 5800, 5820, 5840, 5860, 5880,
5900, 5920, 5940, 5960, 5980, 6000, 6020, 6040, 6060,
6080, 6100, 6120, 6140, 6160, 6180, 6200, 6220, 6240,
6260, 6280, 6300, 6320, 6340, 6360, 6380, 6400, 6420,
6440, 6460, 6480, 6500, 6520, 6540, 6560, 6580, 6600,
6620, 6640, 6660, 6680, 6700, 6720, 6740, 6760, 6780,
6800, 6820, 6840, 6860, 6880, 6900, 6920, 6940, 6960,
6980, 7000, 7020, 7040, 7060, 7080, 7100, 7120, 7140,
7160, 7180, 7200, 7220, 7240, 7260, 7280, 7300, 7320,
7340, 7360, 7380, 7400, 7420, 7440, 7450, 7460, 7470,
7480, 7490, 7500, 7510, 7520, 7530, 7540, 7550, 7570,
7590, 7610, 7630, 7650, 7670, 7690, 7710, 7730, 7750,
7770, 7790, 7810, 7830, 7850, 7870, 7890, 7910, 7930,
7950, 7970, 7990, 8010, 8030, 8050, 8060, 8080, 8100,
8120, 8140, 8160, 8180, 8200, 8220, 8240, 8260, 8280,
8300, 8320, 8340, 8360, 8380, 8400, 8420, 8440, 8460,
8480, 8500, 8520, 8540, 8560, 8580, 8600, 8620, 8640,
8660, 8680, 8700, 8720, 8740, 8760, 8780, 8800, 8820,
8840, 8860, 8880, 8900, 8920, 8940, 8960, 8980, 9000,
9020, 9040, 9060, 9080, 9100, 9120, 9140, 9160, 9180,
9200, 9220, 9240, 9260, 9280, 9300, 9320, 9340, 9360,
9380, 9400, 9420, 9440, 9460, 9480, 9500, 9520, 9540,
9560, 9580, 9600, 9620, 9640, 9660, 9680, 9700, 9720,
9740, 9760, 9780, 9800, 9820, 9840, 9930, 9950, 9970,
9990, 10010, 10030, 10050, 10070, 10090, 10130, 10150,
10170, 10190, 10210, 10230, 10250, 10270, 10290, 10310,
10330, 10350, 10370, 10390, 10410, 10430, 10450, 10470,
10490, 10510, 10530, 10550, 10570, 10590, 10610, 10630,
10650, 10670, 10730, 10750, 10770, 10790, 10810, 10850,
10870, 10890, 10910, 10930, 10950, 10970, 10990, 11010,
11030, 11050, 11070, 11090, 11110, 11130, 11150, 11170,
11190, 11210, 11230, 11250, 11270, 11310, 11330, 11350,
11370, 11390, 11400, 11450, 11500, 11550, 11600, 11650,
11700, 11750, 11800, 11850, 11900, 11950, 12000, 12050,
12100, 12150, 12200, 12250, 12300, 12350, 12400, 12450,
12500, 12550, 12600, 12650, 12700, 12750, 12800, 12850,
12900, 12950, 13000, 13050, 13100, 13150, 13200, 13250,
13300, 13350, 13400, 13450, 13500, 13550, 13600, 13650,
13700, 13750, 13800, 13850, 13900, 13950, 14000, 14050,
14100, 14150, 14200, 14250, 14300, 14350, 14400, 14450,
14500, 14550, 14600, 14650, 14700, 14750, 14800, 14850,
14900, 14950, 15000, 15050, 15100, 15150, 15200, 15250,
15300, 15350, 15400, 15450, 15500, 15550, 15600, 15650,
15700, 15750, 15800, 15850, 15900, 15950, 16000, 16050,
16100, 16150, 16200, 16250, 16300, 16350, 16400, 16450,
16500, 16550, 16600, 16650, 16700, 16750, 16800, 16850,
16900, 16950, 17000, 17050, 17100, 17150, 17200, 17250,
17300, 17350, 17400, 17450, 17500, 17550, 17600, 17650,
17700, 17750, 17800, 17850, 17900, 17950, 18000, 18050,
18100, 18150, 18200, 18250, 18300, 18350, 18400, 18450,
18500, 18550, 18600, 18650, 18700, 18750, 18800, 18850,
18900, 18950, 19000, 19050, 19100, 19150, 19200, 19250,
19300, 19350, 19400, 19450, 19500, 19550, 19600, 19650,
19700, 19750, 19800, 19850, 19900, 19950, 20000, 20050,
20100, 20150, 20200, 20250, 20300, 20350, 20400, 20450,
20500, 20550, 20600, 20650, 20700, 20750, 20800, 20850,
20900, 20950, 21000, 21050, 21100, 21150, 21200, 21250,
21300, 21350, 21400, 21450, 21500, 21550, 21600, 21650,
21700, 21750, 21800, 21850, 21900, 21950),
C14BP = c(0, 178, 126, 85, 113, 120, 118, 101, 148, 219, 176, 169,
136, 110, 136, 207, 272, 334, 371, 349, 341, 322, 319,
362, 365, 405, 411, 425, 502, 540, 622, 654, 625, 596,
629, 711, 782, 792, 810, 818, 865, 871, 883, 950, 914,
949, 935, 915, 932, 974, 1043, 1069, 1105, 1135, 1139,
1137, 1112, 1193, 1210, 1216, 1204, 1218, 1218, 1276,
1295, 1267, 1291, 1299, 1343, 1414, 1448, 1469, 1512,
1503, 1523, 1584, 1580, 1586, 1576, 1583, 1613, 1664,
1689, 1715, 1705, 1737, 1778, 1752, 1724, 1777, 1820,
1846, 1850, 1849, 1843, 1879, 1919, 1904, 1954, 1984,
1974, 2003, 2032, 2027, 2071, 2093, 2090, 2107, 2124,
2112, 2136, 2161, 2228, 2225, 2230, 2258, 2227, 2217,
2193, 2213, 2264, 2313, 2416, 2443, 2430, 2424, 2437,
2438, 2466, 2495, 2505, 2498, 2519, 2501, 2490, 2503,
2475, 2464, 2464, 2459, 2538, 2568, 2662, 2707, 2743,
2750, 2733, 2779, 2815, 2837, 2815, 2833, 2871, 2886,
2905, 2912, 2916, 2905, 2930, 2972, 2947, 2978, 2963,
2986, 3014, 2977, 3049, 3036, 3054, 3103, 3066, 3061,
3096, 3141, 3182, 3210, 3227, 3206, 3226, 3313, 3326,
3308, 3301, 3326, 3357, 3367, 3357, 3423, 3436, 3407,
3476, 3486, 3531, 3508, 3537, 3481, 3502, 3569, 3579,
3593, 3618, 3624, 3672, 3638, 3666, 3725, 3733, 3687,
3688, 3713, 3788, 3753, 3770, 3829, 3817, 3814, 3804,
3853, 3856, 3872, 3892, 3903, 3874, 3922, 3904, 3899,
3988, 4002, 4056, 4020, 4004, 4045, 4088, 4087, 4144,
4111, 4151, 4139, 4202, 4151, 4167, 4179, 4222, 4165,
4106, 4120, 4185, 4281, 4305, 4401, 4406, 4405, 4385,
4372, 4403, 4459, 4424, 4446, 4509, 4523, 4539, 4496,
4526, 4533, 4518, 4465, 4496, 4487, 4522, 4524, 4581,
4639, 4733, 4708, 4683, 4688, 4655, 4647, 4727, 4757,
4805, 4779, 4751, 4730, 4796, 4872, 4900, 4895, 4954,
4969, 4956, 4975, 5016, 5065, 5102, 5086, 5071, 5029,
5057, 5060, 5110, 5162, 5211, 5259, 5220, 5296, 5260,
5309, 5322, 5279, 5319, 5359, 5337, 5272, 5368, 5402,
5447, 5417, 5399, 5447, 5516, 5582, 5570, 5603, 5558,
5576, 5667, 5664, 5683, 5700, 5739, 5742, 5757, 5770,
5798, 5765, 5771, 5807, 5815, 5869, 5847, 5869, 5916,
5943, 5946, 5986, 6005, 5956, 6015, 6031, 6080, 6096,
6098, 6114, 6102, 6118, 6165, 6209, 6203, 6169, 6243,
6201, 6163, 6210, 6273, 6282, 6341, 6383, 6385, 6415,
6463, 6422, 6481, 6430, 6469, 6592, 6582, 6609, 6606,
6614, 6598, 6683, 6687, 6624, 6611, 6645, 6693, 6717,
6760, 6779, 6811, 6808, 6841, 6874, 6905, 6929, 6945,
6970, 6975, 6992, 7001, 7027, 7050, 7093, 7015, 7049,
7113, 7159, 7198, 7228, 7235, 7295, 7326, 7247, 7263,
7327, 7302, 7331, 7411, 7412, 7457, 7474, 7502, 7457,
7494, 7463, 7467, 7515, 7564, 7572, 7637, 7625, 7711,
7745, 7757, 7728, 7774, 7802, 7786, 7848, 7881, 7893,
7906, 7894, 7926, 7952, 7919, 7959, 7990, 7986, 8019,
7944, 7973, 7973, 7999, 7962, 7977, 7951, 7946, 8048,
8049, 8169, 8173, 8173, 8228, 8146, 8222, 8223, 8155,
8219, 8173, 8205, 8251, 8253, 8296, 8327, 8316, 8291,
8299, 8291, 8364, 8422, 8365, 8441, 8509, 8497, 8594,
8594, 8665, 8669, 8678, 8693, 8675, 8676, 8750, 8760,
8800, 8761, 8776, 8755, 8706, 8725, 8740, 8767, 8932,
8936, 8963, 9040, 9062, 9076, 9191, 9164, 9199, 9186,
9222, 9243, 9220, 9254, 9316, 9288, 9191, 9282, 9354,
9322, 9348, 9394, 9436, 9435, 9455, 9460, 9462, 9520,
9506, 9474, 9540, 9559, 9590, 9587, 9609, 9589, 9617,
9630, 9583, 9509, 9529, 9611, 9576, 9599, 9631, 9662,
9673, 9694, 9756, 9793, 9939, 9939, 9963, 9934, 9993,
10001, 10023, 10038, 10038, 9963, 10011, 10060, 10028,
10065, 10009, 10027, 10090, 10039, 10051, 10036, 10047,
10057, 10068, 10080, 10092, 10106, 10121, 10137, 10154,
10173, 10194, 10217, 10242, 10269, 10298, 10330, 10364,
10401, 10440, 10482, 10526, 10572, 10619, 10668, 10719,
10770, 10822, 10875, 10928, 10981, 11035, 11087, 11140,
11192, 11242, 11292, 11341, 11390, 11437, 11484, 11530,
11575, 11620, 11664, 11708, 11752, 11795, 11838, 11881,
11923, 11965, 12006, 12047, 12088, 12128, 12168, 12207,
12246, 12284, 12321, 12359, 12395, 12431, 12466, 12501,
12535, 12569, 12602, 12634, 12666, 12698, 12729, 12760,
12791, 12822, 12853, 12884, 12914, 12945, 12976, 13008,
13039, 13071, 13104, 13137, 13170, 13204, 13238, 13273,
13308, 13344, 13380, 13416, 13453, 13490, 13528, 13566,
13604, 13643, 13682, 13721, 13761, 13801, 13842, 13882,
13923, 13965, 14006, 14048, 14090, 14133, 14176, 14219,
14262, 14305, 14349, 14393, 14437, 14482, 14526, 14571,
14616, 14661, 14707, 14752, 14798, 14844, 14890, 14937,
14984, 15031, 15080, 15128, 15178, 15228, 15278, 15330,
15382, 15435, 15489, 15543, 15597, 15651, 15705, 15760,
15813, 15867, 15920, 15972, 16024, 16074, 16124, 16172,
16219, 16265, 16310, 16354, 16397, 16439, 16481, 16521,
16561, 16600, 16638, 16676, 16713, 16750, 16786, 16822,
16857, 16892, 16927, 16961, 16996, 17030, 17064, 17098,
17132, 17166, 17200, 17234, 17269, 17303, 17338, 17374,
17409, 17445, 17481, 17518, 17554, 17591, 17629, 17666,
17704, 17742, 17780, 17818, 17857, 17895, 17934, 17973,
18012, 18051, 18091, 18130, 18169, 18209, 18248, 18288,
18328, 18367))
c(data_list1, data_list2, data_list3) }
else if (model == "Preeclampsia"){
data_list1 <- load_data_file(filename = "Preeclampsiadatalist.txt",
examples_dir)
data_list2 <- load_data_file(filename = "Preeclampsiadata2.txt",
examples_dir)
c(data_list1, data_list2)
} else if (model == "StVeit"){
data_list1 <- load_data_file(filename = "StVeitdata.txt", examples_dir)
data_list2 <- list(
calBP = c(0, 10, 30, 50, 70, 90, 110,
125, 140, 160, 180, 200, 220, 240, 260, 280, 300, 320,
340, 360, 380, 400, 420, 440, 460, 480, 490, 500, 520,
540, 560, 580, 600, 620, 640, 660, 675, 690, 705, 720,
738, 758, 780, 800, 820, 840, 860, 880, 900, 920, 940,
960, 980, 998, 1010, 1030, 1050, 1070, 1090, 1100, 1120,
1140, 1160, 1180, 1200, 1220, 1240, 1260, 1280, 1300,
1320, 1340, 1360, 1380, 1400, 1420, 1440, 1460, 1480,
1500, 1520, 1540, 1560, 1580, 1600, 1620, 1640, 1660,
1680, 1700, 1720, 1740, 1760, 1780, 1800, 1820, 1840,
1860, 1880, 1900, 1920, 1940, 1960, 1980, 2000, 2020,
2040, 2060, 2080, 2100, 2120, 2140, 2160, 2180, 2200,
2220, 2240, 2260, 2280, 2300, 2320, 2340, 2360, 2380,
2400, 2420, 2440, 2460, 2480, 2500, 2520, 2540, 2560,
2580, 2600, 2620, 2640, 2660, 2680, 2700, 2720, 2740,
2760, 2780, 2800, 2820, 2840, 2860, 2880, 2900, 2920,
2940, 2960, 2980, 3000, 3020, 3040, 3060, 3070, 3090,
3100, 3120, 3140, 3160, 3180, 3200, 3220, 3240, 3260,
3280, 3300, 3320, 3340, 3360, 3380, 3400, 3420, 3440,
3460, 3480, 3500, 3520, 3540, 3560, 3580, 3600, 3620,
3640, 3660, 3680, 3700, 3720, 3740, 3760, 3780, 3800,
3820, 3840, 3860, 3880, 3900, 3920, 3940, 3960, 3980,
4000, 4020, 4040, 4060, 4080, 4100, 4120, 4140, 4160,
4180, 4200, 4220, 4240, 4260, 4280, 4300, 4320, 4340,
4360, 4380, 4400, 4420, 4440, 4460, 4480, 4500, 4520,
4540, 4560, 4580, 4600, 4620, 4640, 4660, 4680, 4700,
4720, 4740, 4760, 4780, 4800, 4820, 4840, 4860, 4880,
4900, 4920, 4940, 4960, 4980, 5000, 5020, 5040, 5060,
5080, 5100, 5120, 5140, 5160, 5180, 5200, 5220, 5240,
5260, 5280, 5300, 5320, 5340, 5360, 5380, 5400, 5420,
5440, 5460, 5480, 5500, 5520, 5540, 5560, 5580, 5600,
5620, 5640, 5660, 5680, 5700, 5720, 5740, 5760, 5780,
5800, 5820, 5840, 5860, 5880, 5900, 5920, 5940, 5960,
5980, 6000, 6020, 6040, 6060, 6080, 6100, 6120, 6140,
6160, 6180, 6200, 6220, 6240, 6260, 6280, 6300, 6320,
6340, 6360, 6380, 6400, 6420, 6440, 6460, 6480, 6500,
6520, 6540, 6560, 6580, 6600, 6620, 6640, 6660, 6680,
6700, 6720, 6740, 6760, 6780, 6800, 6820, 6840, 6860,
6880, 6900, 6920, 6940, 6960, 6980, 7000, 7020, 7040,
7060, 7080, 7100, 7120, 7140, 7160, 7180, 7200, 7220,
7240, 7260, 7280, 7300, 7320, 7340, 7360, 7380, 7400,
7420, 7440, 7450, 7460, 7470, 7480, 7490, 7500, 7510,
7520, 7530, 7540, 7550, 7570, 7590, 7610, 7630, 7650,
7670, 7690, 7710, 7730, 7750, 7770, 7790, 7810, 7830,
7850, 7870, 7890, 7910, 7930, 7950, 7970, 7990, 8010,
8030, 8050, 8060, 8080, 8100, 8120, 8140, 8160, 8180,
8200, 8220, 8240, 8260, 8280, 8300, 8320, 8340, 8360,
8380, 8400, 8420, 8440, 8460, 8480, 8500, 8520, 8540,
8560, 8580, 8600, 8620, 8640, 8660, 8680, 8700, 8720,
8740, 8760, 8780, 8800, 8820, 8840, 8860, 8880, 8900,
8920, 8940, 8960, 8980, 9000, 9020, 9040, 9060, 9080,
9100, 9120, 9140, 9160, 9180, 9200, 9220, 9240, 9260,
9280, 9300, 9320, 9340, 9360, 9380, 9400, 9420, 9440,
9460, 9480, 9500, 9520, 9540, 9560, 9580, 9600, 9620,
9640, 9660, 9680, 9700, 9720, 9740, 9760, 9780, 9800,
9820, 9840, 9930, 9950, 9970, 9990, 10010, 10030, 10050,
10070, 10090, 10130, 10150, 10170, 10190, 10210, 10230,
10250, 10270, 10290, 10310, 10330, 10350, 10370, 10390,
10410, 10430, 10450, 10470, 10490, 10510, 10530, 10550,
10570, 10590, 10610, 10630, 10650, 10670, 10730, 10750,
10770, 10790, 10810, 10850, 10870, 10890, 10910, 10930,
10950, 10970, 10990, 11010, 11030, 11050, 11070, 11090,
11110, 11130, 11150, 11170, 11190, 11210, 11230, 11250,
11270, 11310, 11330, 11350, 11370, 11390, 11400, 11450,
11500, 11550, 11600, 11650, 11700, 11750, 11800, 11850,
11900, 11950, 12000, 12050, 12100, 12150, 12200, 12250,
12300, 12350, 12400, 12450, 12500, 12550, 12600, 12650,
12700, 12750, 12800, 12850, 12900, 12950, 13000, 13050,
13100, 13150, 13200, 13250, 13300, 13350, 13400, 13450,
13500, 13550, 13600, 13650, 13700, 13750, 13800, 13850,
13900, 13950, 14000, 14050, 14100, 14150, 14200, 14250,
14300, 14350, 14400, 14450, 14500, 14550, 14600, 14650,
14700, 14750, 14800, 14850, 14900, 14950, 15000, 15050,
15100, 15150, 15200, 15250, 15300, 15350, 15400, 15450,
15500, 15550, 15600, 15650, 15700, 15750, 15800, 15850,
15900, 15950, 16000, 16050, 16100, 16150, 16200, 16250,
16300, 16350, 16400, 16450, 16500, 16550, 16600, 16650,
16700, 16750, 16800, 16850, 16900, 16950, 17000, 17050,
17100, 17150, 17200, 17250, 17300, 17350, 17400, 17450,
17500, 17550, 17600, 17650, 17700, 17750, 17800, 17850,
17900, 17950, 18000, 18050, 18100, 18150, 18200, 18250,
18300, 18350, 18400, 18450, 18500, 18550, 18600, 18650,
18700, 18750, 18800, 18850, 18900, 18950, 19000, 19050,
19100, 19150, 19200, 19250, 19300, 19350, 19400, 19450,
19500, 19550, 19600, 19650, 19700, 19750, 19800, 19850,
19900, 19950, 20000, 20050, 20100, 20150, 20200, 20250,
20300, 20350, 20400, 20450, 20500, 20550, 20600, 20650,
20700, 20750, 20800, 20850, 20900, 20950, 21000, 21050,
21100, 21150, 21200, 21250, 21300, 21350, 21400, 21450,
21500, 21550, 21600, 21650, 21700, 21750, 21800, 21850,
21900, 21950),
C14BP = c(0, 178, 126, 85, 113, 120, 118,
101, 148, 219, 176, 169, 136, 110, 136, 207, 272, 334,
371, 349, 341, 322, 319, 362, 365, 405, 411, 425, 502,
540, 622, 654, 625, 596, 629, 711, 782, 792, 810, 818,
865, 871, 883, 950, 914, 949, 935, 915, 932, 974, 1043,
1069, 1105, 1135, 1139, 1137, 1112, 1193, 1210, 1216,
1204, 1218, 1218, 1276, 1295, 1267, 1291, 1299, 1343,
1414, 1448, 1469, 1512, 1503, 1523, 1584, 1580, 1586,
1576, 1583, 1613, 1664, 1689, 1715, 1705, 1737, 1778,
1752, 1724, 1777, 1820, 1846, 1850, 1849, 1843, 1879,
1919, 1904, 1954, 1984, 1974, 2003, 2032, 2027, 2071,
2093, 2090, 2107, 2124, 2112, 2136, 2161, 2228, 2225,
2230, 2258, 2227, 2217, 2193, 2213, 2264, 2313, 2416,
2443, 2430, 2424, 2437, 2438, 2466, 2495, 2505, 2498,
2519, 2501, 2490, 2503, 2475, 2464, 2464, 2459, 2538,
2568, 2662, 2707, 2743, 2750, 2733, 2779, 2815, 2837,
2815, 2833, 2871, 2886, 2905, 2912, 2916, 2905, 2930,
2972, 2947, 2978, 2963, 2986, 3014, 2977, 3049, 3036,
3054, 3103, 3066, 3061, 3096, 3141, 3182, 3210, 3227,
3206, 3226, 3313, 3326, 3308, 3301, 3326, 3357, 3367,
3357, 3423, 3436, 3407, 3476, 3486, 3531, 3508, 3537,
3481, 3502, 3569, 3579, 3593, 3618, 3624, 3672, 3638,
3666, 3725, 3733, 3687, 3688, 3713, 3788, 3753, 3770,
3829, 3817, 3814, 3804, 3853, 3856, 3872, 3892, 3903,
3874, 3922, 3904, 3899, 3988, 4002, 4056, 4020, 4004,
4045, 4088, 4087, 4144, 4111, 4151, 4139, 4202, 4151,
4167, 4179, 4222, 4165, 4106, 4120, 4185, 4281, 4305,
4401, 4406, 4405, 4385, 4372, 4403, 4459, 4424, 4446,
4509, 4523, 4539, 4496, 4526, 4533, 4518, 4465, 4496,
4487, 4522, 4524, 4581, 4639, 4733, 4708, 4683, 4688,
4655, 4647, 4727, 4757, 4805, 4779, 4751, 4730, 4796,
4872, 4900, 4895, 4954, 4969, 4956, 4975, 5016, 5065,
5102, 5086, 5071, 5029, 5057, 5060, 5110, 5162, 5211,
5259, 5220, 5296, 5260, 5309, 5322, 5279, 5319, 5359,
5337, 5272, 5368, 5402, 5447, 5417, 5399, 5447, 5516,
5582, 5570, 5603, 5558, 5576, 5667, 5664, 5683, 5700,
5739, 5742, 5757, 5770, 5798, 5765, 5771, 5807, 5815,
5869, 5847, 5869, 5916, 5943, 5946, 5986, 6005, 5956,
6015, 6031, 6080, 6096, 6098, 6114, 6102, 6118, 6165,
6209, 6203, 6169, 6243, 6201, 6163, 6210, 6273, 6282,
6341, 6383, 6385, 6415, 6463, 6422, 6481, 6430, 6469,
6592, 6582, 6609, 6606, 6614, 6598, 6683, 6687, 6624,
6611, 6645, 6693, 6717, 6760, 6779, 6811, 6808, 6841,
6874, 6905, 6929, 6945, 6970, 6975, 6992, 7001, 7027,
7050, 7093, 7015, 7049, 7113, 7159, 7198, 7228, 7235,
7295, 7326, 7247, 7263, 7327, 7302, 7331, 7411, 7412,
7457, 7474, 7502, 7457, 7494, 7463, 7467, 7515, 7564,
7572, 7637, 7625, 7711, 7745, 7757, 7728, 7774, 7802,
7786, 7848, 7881, 7893, 7906, 7894, 7926, 7952, 7919,
7959, 7990, 7986, 8019, 7944, 7973, 7973, 7999, 7962,
7977, 7951, 7946, 8048, 8049, 8169, 8173, 8173, 8228,
8146, 8222, 8223, 8155, 8219, 8173, 8205, 8251, 8253,
8296, 8327, 8316, 8291, 8299, 8291, 8364, 8422, 8365,
8441, 8509, 8497, 8594, 8594, 8665, 8669, 8678, 8693,
8675, 8676, 8750, 8760, 8800, 8761, 8776, 8755, 8706,
8725, 8740, 8767, 8932, 8936, 8963, 9040, 9062, 9076,
9191, 9164, 9199, 9186, 9222, 9243, 9220, 9254, 9316,
9288, 9191, 9282, 9354, 9322, 9348, 9394, 9436, 9435,
9455, 9460, 9462, 9520, 9506, 9474, 9540, 9559, 9590,
9587, 9609, 9589, 9617, 9630, 9583, 9509, 9529, 9611,
9576, 9599, 9631, 9662, 9673, 9694, 9756, 9793, 9939,
9939, 9963, 9934, 9993, 10001, 10023, 10038, 10038, 9963,
10011, 10060, 10028, 10065, 10009, 10027, 10090, 10039,
10051, 10036, 10047, 10057, 10068, 10080, 10092, 10106,
10121, 10137, 10154, 10173, 10194, 10217, 10242, 10269,
10298, 10330, 10364, 10401, 10440, 10482, 10526, 10572,
10619, 10668, 10719, 10770, 10822, 10875, 10928, 10981,
11035, 11087, 11140, 11192, 11242, 11292, 11341, 11390,
11437, 11484, 11530, 11575, 11620, 11664, 11708, 11752,
11795, 11838, 11881, 11923, 11965, 12006, 12047, 12088,
12128, 12168, 12207, 12246, 12284, 12321, 12359, 12395,
12431, 12466, 12501, 12535, 12569, 12602, 12634, 12666,
12698, 12729, 12760, 12791, 12822, 12853, 12884, 12914,
12945, 12976, 13008, 13039, 13071, 13104, 13137, 13170,
13204, 13238, 13273, 13308, 13344, 13380, 13416, 13453,
13490, 13528, 13566, 13604, 13643, 13682, 13721, 13761,
13801, 13842, 13882, 13923, 13965, 14006, 14048, 14090,
14133, 14176, 14219, 14262, 14305, 14349, 14393, 14437,
14482, 14526, 14571, 14616, 14661, 14707, 14752, 14798,
14844, 14890, 14937, 14984, 15031, 15080, 15128, 15178,
15228, 15278, 15330, 15382, 15435, 15489, 15543, 15597,
15651, 15705, 15760, 15813, 15867, 15920, 15972, 16024,
16074, 16124, 16172, 16219, 16265, 16310, 16354, 16397,
16439, 16481, 16521, 16561, 16600, 16638, 16676, 16713,
16750, 16786, 16822, 16857, 16892, 16927, 16961, 16996,
17030, 17064, 17098, 17132, 17166, 17200, 17234, 17269,
17303, 17338, 17374, 17409, 17445, 17481, 17518, 17554,
17591, 17629, 17666, 17704, 17742, 17780, 17818, 17857,
17895, 17934, 17973, 18012, 18051, 18091, 18130, 18169,
18209, 18248, 18288, 18328, 18367))
c(data_list1, data_list2)
} else if (model == "BeetlesProbit"){
load_data_file(filename = "Beetlesdata.txt", examples_dir)
} else {
standard_copy_and_return("data", model, examples_dir)
}
}
#' Set up inits file for running
#'
#' Finds the appropriate inits file and either copies it to the current
#' working directory
#'
#' @inheritParams model_arg
#' @return The full path to the just-created (as a result of copying) file
inits_arg <- function(model, examples_dir){
if (model == "BeetlesProbit"){
custom_copy_and_return("inits", "Beetlesinits.txt", examples_dir)
} else {
standard_copy_and_return("inits", model, examples_dir)
}
}
#' Set up inits1 file for running
#'
#' Finds the appropriate inits1 file and either copies it to the current
#' working directory
#'
#' @inheritParams model_arg
#' @return The full path to the just-created (as a result of copying) file
inits1_arg <- function(model, examples_dir){
if (model == "BeetlesProbit"){
custom_copy_and_return("inits1", "Beetlesinits1.txt", examples_dir)
} else {
standard_copy_and_return("inits1", model, examples_dir)
}
}
#' Set up inits file for running
#'
#' Finds the appropriate inits file and either copies it to the current
#' working directory
#'
#' @param n.chains The number of chains
#' @inheritParams model_arg
#' @return The full path to the just-created (as a result of copying) file
inits_all_arg <- function(model, examples_dir, n.chains){
if (model == "Sixcomp"){
# SixComp is unusual, and hard to specify inits for
NULL
} else {
if (n.chains == 2){
c(inits_arg(model, examples_dir), inits1_arg(model, examples_dir))
} else if (n.chains == 1){
inits_arg(model, examples_dir)
}
}
}
#' Default n.iter for each model
#'
#' Selected to get Gelman-Runbin diagnostic below 1.05
#'
#' @param n.iter Number of iterations, overrides the default
#' @inheritParams model_arg
niter_arg <- function(n.iter, model){
if (!is.null(n.iter)){
n.iter
} else {
custom <- c(`Abbey` = 13000,
`Biopsies` = 6000, # 3000 by GR
`BiRats` = 10000, # 3000 by GR
`Birds` = 10000, # 3000 by GR
`Blockers` = 10000, # 3000 by GR
`Bones` = 10000, # 3000 by GR
`Cervix` = 6000, # 3000 by GR
`DataCloning` = 5000,
`Dyes` = 4000, # 3000 by GR
`Endo` = 10000, # 3000 by GR
`Epil` = 5000, # 4000 by GR
`Eyetracking` = 4000, # 4000 by GR
`Gentians` = 10000,
`HepatitisME` = 12000,
`Hepatitis` = 10000,
`Ice` = 11000,
`Impala` = 10000,
`Inhalers` = 10000,
`Jama` = 10000,
`Kidney` = 11000,
`Leukfr` = 10000,
`Lizards` = 11000,
`Lotka-Volterra` = 6000,
`Magnesium` = 50000,
`Mice` = 4000,
`Otrees` = 15000,
`Oxford` = 9000,
`Pigs` = 10000,
`Pigweights` = 10000,
`StVeit` = 25000)
if (model %in% names(custom)){
custom[model]
} else {
3000
}
}
}
#' Specify whether founders should be fixed
#'
#' @inheritParams model_arg
#' @return A logical of length 1
fix_founder_arg <- function(model){
if (model == "Lsat"){
FALSE
} else {
TRUE
}
}
#' Specify whether to monitor DIC or not
#'
#' @inheritParams model_arg
#' @return A logical of length 1
dic_arg <- function(model){
has_no_dic <- c("Abbey", "Asia", "Camel", "Preeclampsia", "Pigs",
"SmartPhones", "Sparrowhawk", "Stagnant")
if (model %in% has_no_dic){
FALSE
} else {
TRUE
}
}
#' Specify which params to monitor
#'
#' By default, any parameter with an init specified is monitored
#'
#' @inheritParams model_arg
#' @return A character vector of parameter names
param_to_save_arg <- function(model, examples_dir){
if (model == "Sixcomp"){
"solution"
} else {
inits <- dget(file = "inits.txt")
names(inits)
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.