data(birthweight, package="isdals")
weight <- birthweight$weight
weight
## [1] 2968 2795 3163 2925 2625 2847 3292 3473 2628 3176 3421 2975 3317 2729
## [15] 2935 2754 3210 2817 3126 2539 2412 2991 2875 3231
qplot(weight)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
The task is to estimate the mean weight of foetuses in a “population”; let us call this true but unknown quantity for \(\mu\). Based on the data above, the average would be one such estimate: \[ \hat\mu = (y_1 + \dots + y_N)/N \]
mean(weight)
## [1] 2967.667
The standard deviation is a measure of the spread of data
sd(weight)
## [1] 282.0633
Remember the practical interpretation of standard deviation
(max(weight) - min(weight))/4
## [1] 265.25
In addition to having an estimate of the mean, it is often (if not always) desirable to obtain some sort of interval in which we with a certain degree of certainty can say that the true population mean belongs. This leads to confidence intevals.
Let us assume that each observation is the outcome of a normal variable \(Y_i \sim N(\mu,\sigma^2), i=1,\dots, N\).
Then we know that \(\bar Y = (Y_1 + \dots Y_N)/N\) is normal \[ \bar Y \sim N(\mu, SE) \] where \(SE=\sigma^2/N\).
We know that about \(95%\) of the probability mass (or observations) in a normal distribution \(N(\mu,\sigma^2)\) is within the range fram \(\mu-2\sigma\) to \(\mu + 2\sigma\) (actually we should write \(1.96\) rather than \(2\) but that is not important here.). That is
\[ Pr(\mu-2\sigma \le Y \le \mu + 2\sigma) \approx 0.95 \] Rearranging this give
\[ Pr(Y-2\sigma \le \mu \le Y + 2\sigma) \approx 0.95 \]
Notice: The random part above is \(Y\) and so are the end points of the interval \[ [Y-2\sigma; Y+2s\sigma] \] Suppose \(Y \sim N(\mu, 2^2)\) (so \(\sigma\) is known, just for simplicity). Now, observe \(y_1\), and we computed the interval
sigma <- 2
y1 <- 4.5
c(y1 - 2 * sigma, y1 + 2 * sigma)
## [1] 0.5 8.5
y2 <- 7.1
c(y2 - 2 * sigma, y2 + 2 * sigma)
## [1] 3.1 11.1
Now we play the simulation game: \(Y \sim N(\mu, 2^2)\) where we suddenly have divine insight and “know” that \(\mu=10\).
set.seed(14)
M <- 20
mu <- 10
y <- rnorm(M, mean=10, sd=sigma)
ci <- cbind(y - 2 * sigma, y + 2 * sigma)
ci
## [,1] [,2]
## [1,] 4.676300 12.67630
## [2,] 9.437908 17.43791
## [3,] 10.243334 18.24333
## [4,] 8.994307 16.99431
## [5,] 5.927719 13.92772
## [6,] 8.463890 16.46389
## [7,] 5.870238 13.87024
## [8,] 8.137987 16.13799
## [9,] 5.246069 13.24607
## [10,] 8.086366 16.08637
## [11,] 5.234356 13.23436
## [12,] 6.598843 14.59884
## [13,] 7.348480 15.34848
## [14,] 5.414367 13.41437
## [15,] 6.976107 14.97611
## [16,] 7.765604 15.76560
## [17,] 9.725498 17.72550
## [18,] 9.223451 17.22345
## [19,] 6.270959 14.27096
## [20,] 8.176172 16.17617
Notice: For each observation we get an interval. The true value of the parameter (\(\mu=10\)) is either contained in an interval or it is not.
We call the intervals for 95% confidence intervals. It would not be correct to say an interval contains the true parameter with probability 95%: Either the parameter is contained in an interval or it is not.
However if we conduct the experiment many times and compute a confidence interval each time, then 95% of the intervals will contain the true parameter:
set.seed(14)
M <- 1000
mu <- 10
y <- rnorm(M, mean=10, sd=sigma)
ci <- cbind(y - 2 * sigma, y + 2 * sigma)
ci
## [,1] [,2]
## [1,] 4.67630034 12.676300
## [2,] 9.43790831 17.437908
## [3,] 10.24333398 18.243334
## [4,] 8.99430737 16.994307
## [5,] 5.92771884 13.927719
## [6,] 8.46389035 16.463890
## [7,] 5.87023846 13.870238
## [8,] 8.13798746 16.137987
## [9,] 5.24606939 13.246069
## [10,] 8.08636619 16.086366
## [11,] 5.23435624 13.234356
## [12,] 6.59884319 14.598843
## [13,] 7.34847952 15.348480
## [14,] 5.41436736 13.414367
## [15,] 6.97610672 14.976107
## [16,] 7.76560365 15.765604
## [17,] 9.72549796 17.725498
## [18,] 9.22345058 17.223451
## [19,] 6.27095908 14.270959
## [20,] 8.17617202 16.176172
## [21,] 3.46637048 11.466370
## [22,] 5.60283343 13.602833
## [23,] 6.27773156 14.277732
## [24,] 5.44132800 13.441328
## [25,] 7.41783883 15.417839
## [26,] 4.46677908 12.466779
## [27,] 8.88672589 16.886726
## [28,] 7.68975860 15.689759
## [29,] 5.20125919 13.201259
## [30,] 3.14446483 11.144465
## [31,] 3.15601510 11.156015
## [32,] 5.34354342 13.343543
## [33,] 6.56914015 14.569140
## [34,] 7.43867176 15.438672
## [35,] 6.86483195 14.864832
## [36,] 5.29615046 13.296150
## [37,] 6.59544286 14.595443
## [38,] 5.47713528 13.477135
## [39,] 8.61737946 16.617379
## [40,] 6.03174053 14.031741
## [41,] 5.13765126 13.137651
## [42,] 6.76489308 14.764893
## [43,] 6.08225019 14.082250
## [44,] 5.88155200 13.881552
## [45,] 3.40715203 11.407152
## [46,] 1.72604725 9.726047
## [47,] 4.21277063 12.212771
## [48,] 7.22546575 15.225466
## [49,] 7.16594246 15.165942
## [50,] 5.98823597 13.988236
## [51,] 2.26910255 10.269103
## [52,] 9.65996865 17.659969
## [53,] 4.01776820 12.017768
## [54,] 3.09913075 11.099131
## [55,] 5.97035048 13.970350
## [56,] 7.07327811 15.073278
## [57,] 4.37779247 12.377792
## [58,] 5.36335040 13.363350
## [59,] 8.22295201 16.222952
## [60,] 5.71651057 13.716511
## [61,] 5.58924209 13.589242
## [62,] 4.63840841 12.638408
## [63,] 5.91401652 13.914017
## [64,] 3.67689478 11.676895
## [65,] 4.45461566 12.454616
## [66,] 4.16252174 12.162522
## [67,] 6.17830635 14.178306
## [68,] 4.48492174 12.484922
## [69,] 9.49616236 17.496162
## [70,] 6.34092140 14.340921
## [71,] 7.65106226 15.651062
## [72,] 5.96568817 13.965688
## [73,] 6.98444333 14.984443
## [74,] 6.71097794 14.710978
## [75,] 6.22515340 14.225153
## [76,] 8.27405864 16.274059
## [77,] 4.86611031 12.866110
## [78,] 7.10523249 15.105232
## [79,] 5.97499654 13.974997
## [80,] 4.85757878 12.857579
## [81,] 4.63144572 12.631446
## [82,] 8.33861843 16.338618
## [83,] 6.73893735 14.738937
## [84,] 4.97853016 12.978530
## [85,] 4.73691033 12.736910
## [86,] 9.42655592 17.426556
## [87,] 5.55399356 13.553994
## [88,] 4.08220545 12.082205
## [89,] 6.07549048 14.075490
## [90,] 2.71698752 10.716988
## [91,] 7.57998649 15.579986
## [92,] 3.88573926 11.885739
## [93,] 3.94214928 11.942149
## [94,] 8.20185953 16.201860
## [95,] 4.77218004 12.772180
## [96,] 5.30823517 13.308235
## [97,] 6.17198024 14.171980
## [98,] 4.70136741 12.701367
## [99,] 6.61192558 14.611926
## [100,] 4.45709343 12.457093
## [101,] 9.38258444 17.382584
## [102,] 7.31737443 15.317374
## [103,] 5.89000111 13.890001
## [104,] 1.34423791 9.344238
## [105,] 6.26453626 14.264536
## [106,] 5.43329820 13.433298
## [107,] 10.81400689 18.814007
## [108,] 4.99914642 12.999146
## [109,] 6.94367400 14.943674
## [110,] 4.37196965 12.371970
## [111,] 8.78872324 16.788723
## [112,] 1.82232074 9.822321
## [113,] 8.42788080 16.427881
## [114,] 5.99342546 13.993425
## [115,] 8.55592552 16.555926
## [116,] 9.81113763 17.811138
## [117,] 3.99838811 11.998388
## [118,] 6.31365850 14.313658
## [119,] 4.24286539 12.242865
## [120,] 6.03313008 14.033130
## [121,] 4.91072200 12.910722
## [122,] 5.00691992 13.006920
## [123,] 2.76328468 10.763285
## [124,] 5.87372034 13.873720
## [125,] 9.34648908 17.346489
## [126,] 4.07314839 12.073148
## [127,] 5.15197550 13.151976
## [128,] 7.34869301 15.348693
## [129,] 5.23843050 13.238431
## [130,] 7.81482783 15.814828
## [131,] 6.72533395 14.725334
## [132,] 2.02057852 10.020579
## [133,] 3.90789401 11.907894
## [134,] 5.68479397 13.684794
## [135,] 7.43659279 15.436593
## [136,] 7.60546748 15.605467
## [137,] 4.37145042 12.371450
## [138,] 3.54628839 11.546288
## [139,] 6.31528929 14.315289
## [140,] 3.12557372 11.125574
## [141,] 5.36114635 13.361146
## [142,] 8.46844448 16.468444
## [143,] 4.48321391 12.483214
## [144,] 8.66955894 16.669559
## [145,] 7.79302359 15.793024
## [146,] 6.63688742 14.636887
## [147,] 4.65946476 12.659465
## [148,] 4.98345717 12.983457
## [149,] 8.83371014 16.833710
## [150,] 4.31181163 12.311812
## [151,] 8.27765363 16.277654
## [152,] 6.39498636 14.394986
## [153,] 6.70159227 14.701592
## [154,] 5.18477508 13.184775
## [155,] 4.59192645 12.591926
## [156,] 3.32036401 11.320364
## [157,] 5.91193963 13.911940
## [158,] 2.68320562 10.683206
## [159,] 3.97492462 11.974925
## [160,] 2.81694413 10.816944
## [161,] 3.06986449 11.069864
## [162,] 5.48645945 13.486459
## [163,] 7.19864658 15.198647
## [164,] 7.21778639 15.217786
## [165,] 8.57316766 16.573168
## [166,] 6.94368809 14.943688
## [167,] 8.15452844 16.154528
## [168,] 5.95354782 13.953548
## [169,] 5.15415553 13.154156
## [170,] 5.85934104 13.859341
## [171,] 4.93997674 12.939977
## [172,] 6.73578693 14.735787
## [173,] 6.28671989 14.286720
## [174,] 8.14373031 16.143730
## [175,] 6.57048564 14.570486
## [176,] 5.53950995 13.539510
## [177,] 4.30970215 12.309702
## [178,] 6.74544349 14.745443
## [179,] 5.89089908 13.890899
## [180,] 5.57936972 13.579370
## [181,] 7.70336658 15.703367
## [182,] 0.28102914 8.281029
## [183,] 3.60240109 11.602401
## [184,] 6.19205712 14.192057
## [185,] 6.92433292 14.924333
## [186,] 5.68827484 13.688275
## [187,] 7.74993013 15.749930
## [188,] 6.03948851 14.039489
## [189,] 9.05847905 17.058479
## [190,] 6.85938209 14.859382
## [191,] 6.77527325 14.775273
## [192,] 6.77796726 14.777967
## [193,] 6.30413368 14.304134
## [194,] 8.52445188 16.524452
## [195,] 8.14857127 16.148571
## [196,] 3.15748212 11.157482
## [197,] 6.14131418 14.141314
## [198,] 9.29657001 17.296570
## [199,] 3.13787226 11.137872
## [200,] 7.74795862 15.747959
## [201,] 3.93825816 11.938258
## [202,] 4.61319191 12.613192
## [203,] 7.01307377 15.013074
## [204,] 7.71956021 15.719560
## [205,] 8.49454477 16.494545
## [206,] 4.79370313 12.793703
## [207,] 2.07069337 10.070693
## [208,] 3.79977111 11.799771
## [209,] 6.99301407 14.993014
## [210,] 5.94001898 13.940019
## [211,] 5.71265299 13.712653
## [212,] 4.59815718 12.598157
## [213,] 4.27277746 12.272777
## [214,] 8.24894144 16.248941
## [215,] 0.93171712 8.931717
## [216,] 5.77865403 13.778654
## [217,] 8.08107619 16.081076
## [218,] 7.68339263 15.683393
## [219,] 6.53589805 14.535898
## [220,] 8.68619699 16.686197
## [221,] 5.58806796 13.588068
## [222,] 4.54374885 12.543749
## [223,] 2.18503422 10.185034
## [224,] 7.67792510 15.677925
## [225,] 3.88732508 11.887325
## [226,] 5.40805060 13.408051
## [227,] 4.42348730 12.423487
## [228,] 3.00911634 11.009116
## [229,] 4.68269437 12.682694
## [230,] 8.63115006 16.631150
## [231,] 6.16008527 14.160085
## [232,] 8.28974431 16.289744
## [233,] 7.25047255 15.250473
## [234,] 4.90341065 12.903411
## [235,] 3.58002986 11.580030
## [236,] 6.73193077 14.731931
## [237,] 5.52935424 13.529354
## [238,] 3.70009296 11.700093
## [239,] 7.85772775 15.857728
## [240,] 4.00973349 12.009733
## [241,] 7.14070003 15.140700
## [242,] 5.08901604 13.089016
## [243,] 5.03716814 13.037168
## [244,] 9.69897641 17.698976
## [245,] 8.19726069 16.197261
## [246,] 3.06618731 11.066187
## [247,] 10.18452662 18.184527
## [248,] 7.67964411 15.679644
## [249,] 3.89917352 11.899174
## [250,] 2.91989864 10.919899
## [251,] 9.31123515 17.311235
## [252,] 1.42497476 9.424975
## [253,] 8.05328395 16.053284
## [254,] 8.52323946 16.523239
## [255,] 6.27068411 14.270684
## [256,] 2.13929533 10.139295
## [257,] 4.63395189 12.633952
## [258,] 3.95530366 11.955304
## [259,] 1.96297860 9.962979
## [260,] 3.32780411 11.327804
## [261,] 5.32952268 13.329523
## [262,] 3.58899804 11.588998
## [263,] 5.64620021 13.646200
## [264,] 6.35216309 14.352163
## [265,] 4.58811909 12.588119
## [266,] 8.48363027 16.483630
## [267,] 4.44263735 12.442637
## [268,] 6.53961005 14.539610
## [269,] 8.87968555 16.879686
## [270,] 6.43452849 14.434528
## [271,] 6.59438790 14.594388
## [272,] 4.85681345 12.856813
## [273,] 5.54990615 13.549906
## [274,] 3.54324753 11.543248
## [275,] 6.11195859 14.111959
## [276,] 5.11384661 13.113847
## [277,] 5.97285725 13.972857
## [278,] 5.59552999 13.595530
## [279,] 6.43787311 14.437873
## [280,] 7.04258813 15.042588
## [281,] 2.81768514 10.817685
## [282,] 5.35040624 13.350406
## [283,] 3.22243614 11.222436
## [284,] 3.01017856 11.010179
## [285,] 6.74683391 14.746834
## [286,] 3.96633871 11.966339
## [287,] 10.87938937 18.879389
## [288,] 6.55083460 14.550835
## [289,] 6.26224310 14.262243
## [290,] 7.93441596 15.934416
## [291,] 3.81279613 11.812796
## [292,] 5.93190711 13.931907
## [293,] 5.13475854 13.134759
## [294,] 3.24843872 11.248439
## [295,] 7.93985250 15.939853
## [296,] 3.43054913 11.430549
## [297,] 5.43396301 13.433963
## [298,] 6.44368859 14.443689
## [299,] 8.64299454 16.642995
## [300,] 3.16650451 11.166505
## [301,] 10.47584787 18.475848
## [302,] 4.84983111 12.849831
## [303,] 4.57165802 12.571658
## [304,] 6.04118957 14.041190
## [305,] 4.29203694 12.292037
## [306,] 11.35063887 19.350639
## [307,] 6.28785063 14.287851
## [308,] 5.80143476 13.801435
## [309,] 8.18877396 16.188774
## [310,] 4.55700870 12.557009
## [311,] 4.73210296 12.732103
## [312,] 4.36689758 12.366898
## [313,] 5.99730491 13.997305
## [314,] 6.57527958 14.575280
## [315,] 3.59638310 11.596383
## [316,] 9.77510436 17.775104
## [317,] 3.83052150 11.830521
## [318,] 5.04708692 13.047087
## [319,] 7.82864405 15.828644
## [320,] 2.17461915 10.174619
## [321,] 3.67515416 11.675154
## [322,] 6.52836706 14.528367
## [323,] 3.19780899 11.197809
## [324,] 4.38842668 12.388427
## [325,] 5.01963530 13.019635
## [326,] 6.01047055 14.010471
## [327,] 3.77329047 11.773290
## [328,] 3.89293492 11.892935
## [329,] 6.27609644 14.276096
## [330,] 2.23593105 10.235931
## [331,] 5.69775681 13.697757
## [332,] 5.01056153 13.010562
## [333,] 6.63059047 14.630590
## [334,] 4.32758774 12.327588
## [335,] 5.62924294 13.629243
## [336,] 9.67523721 17.675237
## [337,] 5.53516973 13.535170
## [338,] 6.43919523 14.439195
## [339,] 9.54968394 17.549684
## [340,] 5.46225479 13.462255
## [341,] 8.79415328 16.794153
## [342,] 7.45310815 15.453108
## [343,] 4.64118450 12.641184
## [344,] 6.95815396 14.958154
## [345,] 3.67260505 11.672605
## [346,] 7.12201093 15.122011
## [347,] 3.05320095 11.053201
## [348,] 8.87991773 16.879918
## [349,] 5.43798453 13.437985
## [350,] 5.11409424 13.114094
## [351,] 8.11949023 16.119490
## [352,] 4.38503607 12.385036
## [353,] 5.86696347 13.866963
## [354,] 9.94184216 17.941842
## [355,] 6.17568422 14.175684
## [356,] 3.96922799 11.969228
## [357,] 10.86209534 18.862095
## [358,] 11.26499773 19.264998
## [359,] 6.92684637 14.926846
## [360,] 3.89536048 11.895360
## [361,] 8.08114039 16.081140
## [362,] 5.15118904 13.151189
## [363,] 2.95430337 10.954303
## [364,] 7.13924647 15.139246
## [365,] 7.21594426 15.215944
## [366,] 4.62055097 12.620551
## [367,] 5.71968449 13.719684
## [368,] 3.42986557 11.429866
## [369,] 3.44518814 11.445188
## [370,] 9.56544896 17.565449
## [371,] 7.32485688 15.324857
## [372,] 6.39605564 14.396056
## [373,] 7.95459154 15.954592
## [374,] 5.27628634 13.276286
## [375,] 1.87463663 9.874637
## [376,] 3.35882009 11.358820
## [377,] 9.33542134 17.335421
## [378,] 6.69684620 14.696846
## [379,] 4.74418984 12.744190
## [380,] 7.09658352 15.096584
## [381,] 8.65667416 16.656674
## [382,] 7.24572084 15.245721
## [383,] 6.71884769 14.718848
## [384,] 8.14585059 16.145851
## [385,] 7.40229376 15.402294
## [386,] 5.97157659 13.971577
## [387,] 6.42315913 14.423159
## [388,] 3.64008783 11.640088
## [389,] 4.69015290 12.690153
## [390,] 5.69388216 13.693882
## [391,] 1.76735118 9.767351
## [392,] 5.47563846 13.475638
## [393,] 4.48396258 12.483963
## [394,] 5.40232688 13.402327
## [395,] 8.28126424 16.281264
## [396,] 7.73843408 15.738434
## [397,] 3.42858565 11.428586
## [398,] 3.51301275 11.513013
## [399,] 5.08734146 13.087341
## [400,] 6.67351147 14.673511
## [401,] 4.28126195 12.281262
## [402,] 8.75647119 16.756471
## [403,] 8.05600748 16.056007
## [404,] 5.03783084 13.037831
## [405,] 8.20687778 16.206878
## [406,] 9.57157336 17.571573
## [407,] 5.19012455 13.190125
## [408,] 4.46473463 12.464735
## [409,] 2.83320285 10.833203
## [410,] 4.05058685 12.050587
## [411,] 9.45603808 17.456038
## [412,] 2.74767426 10.747674
## [413,] 9.11651008 17.116510
## [414,] 3.12280543 11.122805
## [415,] 6.01383731 14.013837
## [416,] 6.05191099 14.051911
## [417,] 3.13128310 11.131283
## [418,] 0.85816316 8.858163
## [419,] 8.50135988 16.501360
## [420,] 4.05920801 12.059208
## [421,] 2.25590474 10.255905
## [422,] 1.82271310 9.822713
## [423,] 4.74907675 12.749077
## [424,] 8.73313755 16.733138
## [425,] 5.33350462 13.333505
## [426,] 4.71181229 12.711812
## [427,] 6.24526817 14.245268
## [428,] 5.67077748 13.670777
## [429,] 2.52826461 10.528265
## [430,] 10.68013963 18.680140
## [431,] 6.86140674 14.861407
## [432,] 7.18043457 15.180435
## [433,] 5.21852869 13.218529
## [434,] 3.37542677 11.375427
## [435,] 6.43691879 14.436919
## [436,] 5.11041169 13.110412
## [437,] 5.90901438 13.909014
## [438,] 7.33870611 15.338706
## [439,] 7.58657079 15.586571
## [440,] 4.12657247 12.126572
## [441,] 1.98679632 9.986796
## [442,] 7.92363759 15.923638
## [443,] 8.18323666 16.183237
## [444,] 7.47058130 15.470581
## [445,] 3.93587587 11.935876
## [446,] 6.85204427 14.852044
## [447,] 7.76491522 15.764915
## [448,] 11.00572388 19.005724
## [449,] 3.35279327 11.352793
## [450,] 7.85042312 15.850423
## [451,] 6.52562180 14.525622
## [452,] 6.06448268 14.064483
## [453,] 9.15201328 17.152013
## [454,] 9.05304883 17.053049
## [455,] 8.29287094 16.292871
## [456,] 6.12573672 14.125737
## [457,] 4.24570673 12.245707
## [458,] 3.06500935 11.065009
## [459,] 3.56578059 11.565781
## [460,] 4.43716286 12.437163
## [461,] 3.89042638 11.890426
## [462,] 10.37185961 18.371860
## [463,] 5.65013369 13.650134
## [464,] 9.25246480 17.252465
## [465,] 5.13519605 13.135196
## [466,] 4.89459466 12.894595
## [467,] 2.15793369 10.157934
## [468,] 4.67001134 12.670011
## [469,] 6.85085279 14.850853
## [470,] 5.44007635 13.440076
## [471,] 9.98625771 17.986258
## [472,] 6.85664935 14.856649
## [473,] 4.14919047 12.149190
## [474,] 7.93399772 15.933998
## [475,] 6.34695793 14.346958
## [476,] 6.41306376 14.413064
## [477,] 2.64953459 10.649535
## [478,] 6.13988461 14.139885
## [479,] 5.74368639 13.743686
## [480,] 6.63891988 14.638920
## [481,] 9.95171732 17.951717
## [482,] 6.36385831 14.363858
## [483,] 7.93704389 15.937044
## [484,] 4.86588388 12.865884
## [485,] 4.49548811 12.495488
## [486,] 0.34704362 8.347044
## [487,] 3.97356993 11.973570
## [488,] 7.15399724 15.153997
## [489,] 7.68012632 15.680126
## [490,] 6.20966219 14.209662
## [491,] 5.12942879 13.129429
## [492,] 6.37460528 14.374605
## [493,] 9.28860403 17.288604
## [494,] 4.50927798 12.509278
## [495,] 7.99705526 15.997055
## [496,] 5.60127845 13.601278
## [497,] 6.34141065 14.341411
## [498,] 7.43349629 15.433496
## [499,] 4.55209785 12.552098
## [500,] 4.21935052 12.219351
## [501,] 6.34926416 14.349264
## [502,] 2.83659894 10.836599
## [503,] 9.15796030 17.157960
## [504,] 7.59725842 15.597258
## [505,] 3.12008787 11.120088
## [506,] 7.10586684 15.105867
## [507,] 6.98937127 14.989371
## [508,] 3.23433741 11.234337
## [509,] 6.70106534 14.701065
## [510,] 8.26058600 16.260586
## [511,] 8.63563795 16.635638
## [512,] 4.52402055 12.524021
## [513,] 3.24723337 11.247233
## [514,] 5.11088892 13.110889
## [515,] 5.86002273 13.860023
## [516,] 0.81649251 8.816493
## [517,] 5.76724257 13.767243
## [518,] 5.99361360 13.993614
## [519,] 5.59634633 13.596346
## [520,] 4.47731131 12.477311
## [521,] 4.32560354 12.325604
## [522,] 5.20118333 13.201183
## [523,] 1.70672128 9.706721
## [524,] 1.37876876 9.378769
## [525,] 5.13965466 13.139655
## [526,] 6.81365044 14.813650
## [527,] 5.72107233 13.721072
## [528,] 3.41561991 11.415620
## [529,] 6.01878221 14.018782
## [530,] 3.58201174 11.582012
## [531,] 4.25911604 12.259116
## [532,] 4.91529231 12.915292
## [533,] 5.24919201 13.249192
## [534,] 4.89781973 12.897820
## [535,] 6.21905229 14.219052
## [536,] 6.39660576 14.396606
## [537,] 3.56248875 11.562489
## [538,] 4.54963599 12.549636
## [539,] 4.52494301 12.524943
## [540,] 9.33742385 17.337424
## [541,] 4.71135522 12.711355
## [542,] 7.03569649 15.035696
## [543,] 6.64296958 14.642970
## [544,] 3.99298254 11.992983
## [545,] 5.09605845 13.096058
## [546,] 3.43591002 11.435910
## [547,] 2.49975102 10.499751
## [548,] 2.94355593 10.943556
## [549,] 8.42371815 16.423718
## [550,] 7.59451108 15.594511
## [551,] 5.53328179 13.533282
## [552,] 6.80343160 14.803432
## [553,] 6.07201502 14.072015
## [554,] 6.06388741 14.063887
## [555,] 11.28205550 19.282056
## [556,] 5.08130148 13.081301
## [557,] 8.61518389 16.615184
## [558,] 7.78703289 15.787033
## [559,] 4.01978211 12.019782
## [560,] 8.03606235 16.036062
## [561,] 2.17424814 10.174248
## [562,] 5.34024362 13.340244
## [563,] 5.55440787 13.554408
## [564,] 3.96860154 11.968602
## [565,] 8.17341588 16.173416
## [566,] 4.93067299 12.930673
## [567,] 8.16968086 16.169681
## [568,] 3.57714391 11.577144
## [569,] 3.18738373 11.187384
## [570,] 5.65442767 13.654428
## [571,] 6.03120981 14.031210
## [572,] 5.52962941 13.529629
## [573,] 7.20808222 15.208082
## [574,] 5.47862593 13.478626
## [575,] 8.21015160 16.210152
## [576,] 4.36838961 12.368390
## [577,] 6.47838847 14.478388
## [578,] 9.29385305 17.293853
## [579,] 3.58004706 11.580047
## [580,] 3.23990743 11.239907
## [581,] 8.46360572 16.463606
## [582,] 4.30189170 12.301892
## [583,] 7.96667203 15.966672
## [584,] 6.15740333 14.157403
## [585,] 8.24668281 16.246683
## [586,] 8.96207335 16.962073
## [587,] 11.42629330 19.426293
## [588,] 4.79679266 12.796793
## [589,] 9.60181419 17.601814
## [590,] 6.58688436 14.586884
## [591,] 5.43915593 13.439156
## [592,] 9.76946099 17.769461
## [593,] 7.49398686 15.493987
## [594,] 8.19777843 16.197778
## [595,] 6.58673671 14.586737
## [596,] 7.49672407 15.496724
## [597,] 2.10876045 10.108760
## [598,] 5.29618350 13.296184
## [599,] 7.53520194 15.535202
## [600,] 4.04090434 12.040904
## [601,] 3.69508898 11.695089
## [602,] 4.12852047 12.128520
## [603,] 2.48683901 10.486839
## [604,] 6.46888703 14.468887
## [605,] 8.41738251 16.417383
## [606,] 7.10693889 15.106939
## [607,] 6.95819905 14.958199
## [608,] 7.41205706 15.412057
## [609,] 2.18731131 10.187311
## [610,] 7.56420745 15.564207
## [611,] 9.47196800 17.471968
## [612,] 6.68236137 14.682361
## [613,] 4.88433472 12.884335
## [614,] 2.66586179 10.665862
## [615,] 4.65041794 12.650418
## [616,] 6.54379489 14.543795
## [617,] 7.62257999 15.622580
## [618,] 6.10119822 14.101198
## [619,] 4.79156409 12.791564
## [620,] 4.40165268 12.401653
## [621,] 7.57852826 15.578528
## [622,] 8.03979642 16.039796
## [623,] 7.49728135 15.497281
## [624,] 7.20509223 15.205092
## [625,] 1.94802263 9.948023
## [626,] 4.97416028 12.974160
## [627,] 6.63225128 14.632251
## [628,] 8.52548178 16.525482
## [629,] 3.84476353 11.844764
## [630,] 7.34725295 15.347253
## [631,] 6.78523976 14.785240
## [632,] 5.94041596 13.940416
## [633,] 5.81873589 13.818736
## [634,] 6.79034051 14.790341
## [635,] 3.27146320 11.271463
## [636,] 4.59736711 12.597367
## [637,] 2.01893238 10.018932
## [638,] 7.88354792 15.883548
## [639,] 7.27950911 15.279509
## [640,] 9.06878794 17.068788
## [641,] 3.55577404 11.555774
## [642,] 8.11298820 16.112988
## [643,] 4.04665456 12.046655
## [644,] 5.06730315 13.067303
## [645,] 4.90039532 12.900395
## [646,] 2.27254946 10.272549
## [647,] 6.66262408 14.662624
## [648,] 3.05272870 11.052729
## [649,] 6.04496816 14.044968
## [650,] 4.67227984 12.672280
## [651,] 4.68643658 12.686437
## [652,] 3.63570389 11.635704
## [653,] 6.81808353 14.818084
## [654,] 6.70509261 14.705093
## [655,] 4.08767455 12.087675
## [656,] 3.95159823 11.951598
## [657,] 5.03616278 13.036163
## [658,] 3.94383629 11.943836
## [659,] 4.41756534 12.417565
## [660,] 6.12048896 14.120489
## [661,] 5.70516779 13.705168
## [662,] 8.31865938 16.318659
## [663,] 2.16095135 10.160951
## [664,] 8.07219518 16.072195
## [665,] 9.40126027 17.401260
## [666,] 5.67550238 13.675502
## [667,] 7.26287701 15.262877
## [668,] 5.97666009 13.976660
## [669,] 5.49968087 13.499681
## [670,] 4.99634897 12.996349
## [671,] 6.58008189 14.580082
## [672,] 8.84932346 16.849323
## [673,] 6.94785081 14.947851
## [674,] 9.74456514 17.744565
## [675,] 8.28417754 16.284178
## [676,] 3.50442640 11.504426
## [677,] 7.79825366 15.798254
## [678,] 6.80270927 14.802709
## [679,] 3.35806959 11.358070
## [680,] 5.66818145 13.668181
## [681,] 5.53742341 13.537423
## [682,] 4.46169989 12.461700
## [683,] 9.47703244 17.477032
## [684,] 0.07420639 8.074206
## [685,] 3.61091298 11.610913
## [686,] 7.06867837 15.068678
## [687,] 7.35429155 15.354292
## [688,] 6.90894024 14.908940
## [689,] 4.29806251 12.298063
## [690,] 9.01055010 17.010550
## [691,] 7.36837691 15.368377
## [692,] 4.95391477 12.953915
## [693,] 8.15182713 16.151827
## [694,] 8.90852565 16.908526
## [695,] 7.57406202 15.574062
## [696,] 3.43569118 11.435691
## [697,] 7.93441735 15.934417
## [698,] 6.22480510 14.224805
## [699,] 10.62216917 18.622169
## [700,] 5.20409207 13.204092
## [701,] 9.15473805 17.154738
## [702,] 6.75047192 14.750472
## [703,] 6.95415559 14.954156
## [704,] 9.27656569 17.276566
## [705,] 5.09328294 13.093283
## [706,] 6.28406752 14.284068
## [707,] 4.06046922 12.060469
## [708,] 3.67435593 11.674356
## [709,] 2.76845613 10.768456
## [710,] 6.21602347 14.216023
## [711,] 3.36698355 11.366984
## [712,] 8.53606529 16.536065
## [713,] 6.49262624 14.492626
## [714,] 6.57253788 14.572538
## [715,] 5.15923037 13.159230
## [716,] 8.84557058 16.845571
## [717,] 1.98802373 9.988024
## [718,] 3.19252272 11.192523
## [719,] 8.12764056 16.127641
## [720,] 6.06660159 14.066602
## [721,] 5.25848443 13.258484
## [722,] 9.86959845 17.869598
## [723,] 6.23751852 14.237519
## [724,] 7.03961021 15.039610
## [725,] 6.82427414 14.824274
## [726,] 4.44474903 12.444749
## [727,] 4.54553765 12.545538
## [728,] 4.61215950 12.612159
## [729,] 4.80111567 12.801116
## [730,] 4.65836349 12.658363
## [731,] 4.57386636 12.573866
## [732,] 5.28587917 13.285879
## [733,] 6.57738418 14.577384
## [734,] 3.24626374 11.246264
## [735,] 4.17590819 12.175908
## [736,] 7.86706887 15.867069
## [737,] 8.96617347 16.966173
## [738,] 6.97766014 14.977660
## [739,] 7.42948808 15.429488
## [740,] 5.11908034 13.119080
## [741,] 9.15218789 17.152188
## [742,] 3.83541818 11.835418
## [743,] 3.92457706 11.924577
## [744,] 3.34111132 11.341111
## [745,] 7.57743202 15.577432
## [746,] 5.40050781 13.400508
## [747,] 3.67395899 11.673959
## [748,] 11.84431581 19.844316
## [749,] 5.49381165 13.493812
## [750,] 5.23855329 13.238553
## [751,] 7.62039304 15.620393
## [752,] 10.02216324 18.022163
## [753,] 5.69450032 13.694500
## [754,] 7.88846059 15.888461
## [755,] 7.52904469 15.529045
## [756,] 3.91877127 11.918771
## [757,] 5.86753507 13.867535
## [758,] 9.75102618 17.751026
## [759,] 9.26937825 17.269378
## [760,] 7.88982998 15.889830
## [761,] 6.80686032 14.806860
## [762,] 5.41085282 13.410853
## [763,] 4.76203462 12.762035
## [764,] 4.82013574 12.820136
## [765,] 9.80148214 17.801482
## [766,] 3.78251546 11.782515
## [767,] 7.23416805 15.234168
## [768,] 6.05263721 14.052637
## [769,] 4.83180195 12.831802
## [770,] 4.70293895 12.702939
## [771,] 5.52653707 13.526537
## [772,] 6.04666684 14.046667
## [773,] 9.39862945 17.398629
## [774,] 2.44552519 10.445525
## [775,] 2.39148355 10.391484
## [776,] 4.49003838 12.490038
## [777,] 3.96584736 11.965847
## [778,] 6.57466283 14.574663
## [779,] 6.72436844 14.724368
## [780,] 4.00977622 12.009776
## [781,] 1.53771207 9.537712
## [782,] 7.29763131 15.297631
## [783,] 4.87007283 12.870073
## [784,] 5.81458614 13.814586
## [785,] 7.18365609 15.183656
## [786,] 0.64539734 8.645397
## [787,] 11.26669934 19.266699
## [788,] 7.61459508 15.614595
## [789,] 8.40888693 16.408887
## [790,] 4.03692377 12.036924
## [791,] 7.55754612 15.557546
## [792,] 7.09942912 15.099429
## [793,] 9.29434092 17.294341
## [794,] 4.07717000 12.077170
## [795,] 11.15954008 19.159540
## [796,] 3.71520663 11.715207
## [797,] 5.28207434 13.282074
## [798,] 2.28096912 10.280969
## [799,] 9.44498226 17.444982
## [800,] 6.40509339 14.405093
## [801,] 7.61723993 15.617240
## [802,] 5.81624215 13.816242
## [803,] 3.91563932 11.915639
## [804,] 7.39906138 15.399061
## [805,] 7.04718098 15.047181
## [806,] 3.29860240 11.298602
## [807,] 5.26434744 13.264347
## [808,] 6.74385030 14.743850
## [809,] 2.60862606 10.608626
## [810,] 1.85094596 9.850946
## [811,] 6.66985887 14.669859
## [812,] 4.74593993 12.745940
## [813,] 8.00046582 16.000466
## [814,] 5.86463868 13.864639
## [815,] 5.38690987 13.386910
## [816,] 6.88580670 14.885807
## [817,] 8.07329005 16.073290
## [818,] 4.81805563 12.818056
## [819,] 8.13790344 16.137903
## [820,] 5.42487753 13.424878
## [821,] 8.21731714 16.217317
## [822,] 3.61322000 11.613220
## [823,] 10.31594805 18.315948
## [824,] 7.01392930 15.013929
## [825,] 5.22625130 13.226251
## [826,] 6.24224397 14.242244
## [827,] 9.72704970 17.727050
## [828,] 5.62731278 13.627313
## [829,] 4.20979634 12.209796
## [830,] 5.22449985 13.224500
## [831,] 4.03451776 12.034518
## [832,] 6.15820687 14.158207
## [833,] 3.02291036 11.022910
## [834,] 10.06856847 18.068568
## [835,] 8.82488630 16.824886
## [836,] 5.15588611 13.155886
## [837,] 6.26615410 14.266154
## [838,] 4.18076654 12.180767
## [839,] 5.45143310 13.451433
## [840,] 2.01258241 10.012582
## [841,] 6.77394187 14.773942
## [842,] 5.78026522 13.780265
## [843,] 3.71966712 11.719667
## [844,] 7.04971351 15.049714
## [845,] 6.90703767 14.907038
## [846,] 6.44312762 14.443128
## [847,] 8.54696584 16.546966
## [848,] 6.14452547 14.144525
## [849,] 5.01476117 13.014761
## [850,] 7.13107236 15.131072
## [851,] 8.55433246 16.554332
## [852,] 9.60108235 17.601082
## [853,] 1.61262386 9.612624
## [854,] 2.28979435 10.289794
## [855,] 9.38322258 17.383223
## [856,] 2.04949629 10.049496
## [857,] 6.87183697 14.871837
## [858,] 6.38084060 14.380841
## [859,] 8.64818637 16.648186
## [860,] 4.63905016 12.639050
## [861,] 5.37057421 13.370574
## [862,] 6.26113564 14.261136
## [863,] 5.72710243 13.727102
## [864,] 8.47637743 16.476377
## [865,] 4.37430572 12.374306
## [866,] 6.59428113 14.594281
## [867,] 5.14943755 13.149438
## [868,] 5.74317465 13.743175
## [869,] 6.80378984 14.803790
## [870,] 7.97076365 15.970764
## [871,] 8.90136162 16.901362
## [872,] 9.22182165 17.221822
## [873,] 3.87872586 11.878726
## [874,] 6.61868417 14.618684
## [875,] 5.74668125 13.746681
## [876,] 5.16936075 13.169361
## [877,] 3.86762289 11.867623
## [878,] 7.63122380 15.631224
## [879,] 6.32071460 14.320715
## [880,] 5.64044234 13.640442
## [881,] 3.80877598 11.808776
## [882,] 5.84651064 13.846511
## [883,] 6.56507014 14.565070
## [884,] 1.76339068 9.763391
## [885,] 4.90148367 12.901484
## [886,] 6.24639853 14.246399
## [887,] 3.78457760 11.784578
## [888,] 6.45042852 14.450429
## [889,] 1.99682283 9.996823
## [890,] 3.25378768 11.253788
## [891,] 8.16813093 16.168131
## [892,] 5.13187328 13.131873
## [893,] 4.87108338 12.871083
## [894,] 5.24994320 13.249943
## [895,] 4.93916993 12.939170
## [896,] 7.17461899 15.174619
## [897,] 4.68826128 12.688261
## [898,] 5.80918756 13.809188
## [899,] 0.74970103 8.749701
## [900,] 4.59483808 12.594838
## [901,] 7.76580313 15.765803
## [902,] 7.12676514 15.126765
## [903,] 8.09829215 16.098292
## [904,] 6.63963241 14.639632
## [905,] 3.78823212 11.788232
## [906,] 4.45783438 12.457834
## [907,] 6.95585328 14.955853
## [908,] 5.35070265 13.350703
## [909,] 7.17541328 15.175413
## [910,] 2.94864258 10.948643
## [911,] 8.41459816 16.414598
## [912,] 5.15331078 13.153311
## [913,] 7.58677461 15.586775
## [914,] 6.22300643 14.223006
## [915,] 7.04425664 15.044257
## [916,] 5.03476446 13.034764
## [917,] 5.75763751 13.757638
## [918,] 6.46538812 14.465388
## [919,] 10.41664229 18.416642
## [920,] 5.75815935 13.758159
## [921,] 5.45822878 13.458229
## [922,] 9.05070004 17.050700
## [923,] 5.45021652 13.450217
## [924,] 9.09609980 17.096100
## [925,] 8.18842951 16.188430
## [926,] 7.93132175 15.931322
## [927,] 3.11402186 11.114022
## [928,] 7.46955219 15.469552
## [929,] 6.49119812 14.491198
## [930,] 8.04651629 16.046516
## [931,] 4.19798811 12.197988
## [932,] 4.88053228 12.880532
## [933,] 6.72232076 14.722321
## [934,] 9.19105201 17.191052
## [935,] 4.33182715 12.331827
## [936,] 4.10771035 12.107710
## [937,] 6.92340903 14.923409
## [938,] 9.06588837 17.065888
## [939,] 7.37598838 15.375988
## [940,] 4.15495596 12.154956
## [941,] 5.56778528 13.567785
## [942,] 8.21209216 16.212092
## [943,] 1.90732003 9.907320
## [944,] 1.04312928 9.043129
## [945,] 4.11281091 12.112811
## [946,] 6.40766824 14.407668
## [947,] 7.37869381 15.378694
## [948,] 4.34601701 12.346017
## [949,] 5.30005186 13.300052
## [950,] 7.85056648 15.850566
## [951,] 7.98648746 15.986487
## [952,] 7.20554888 15.205549
## [953,] 7.70262761 15.702628
## [954,] 5.83201136 13.832011
## [955,] 8.02495296 16.024953
## [956,] 11.46536792 19.465368
## [957,] 5.91921050 13.919210
## [958,] 7.88757868 15.887579
## [959,] 7.35341892 15.353419
## [960,] 2.96059808 10.960598
## [961,] 4.58905473 12.589055
## [962,] 6.81991117 14.819911
## [963,] 6.77444742 14.774447
## [964,] 5.54843117 13.548431
## [965,] 6.82003762 14.820038
## [966,] 5.60274427 13.602744
## [967,] 7.52848449 15.528484
## [968,] 6.74977245 14.749772
## [969,] 6.02701841 14.027018
## [970,] 4.57636990 12.576370
## [971,] 2.88557283 10.885573
## [972,] 9.41623480 17.416235
## [973,] 6.62011346 14.620113
## [974,] 4.99413302 12.994133
## [975,] 5.72357185 13.723572
## [976,] 5.95175073 13.951751
## [977,] 6.96341087 14.963411
## [978,] 5.30960969 13.309610
## [979,] 4.64242226 12.642422
## [980,] 8.06096324 16.060963
## [981,] 5.38955743 13.389557
## [982,] 2.11130015 10.111300
## [983,] 7.23494989 15.234950
## [984,] 6.27895182 14.278952
## [985,] 7.50107313 15.501073
## [986,] 4.41819452 12.418195
## [987,] 8.09902397 16.099024
## [988,] 3.73140943 11.731409
## [989,] 4.12548557 12.125486
## [990,] 7.04742547 15.047425
## [991,] 6.83967846 14.839678
## [992,] 5.20377222 13.203772
## [993,] 6.37951688 14.379517
## [994,] 5.36088847 13.360888
## [995,] 3.87500961 11.875010
## [996,] 10.41376834 18.413768
## [997,] 5.07497731 13.074977
## [998,] 5.64181559 13.641816
## [999,] 6.24964267 14.249643
## [1000,] 4.19984832 12.199848
head(ci)
## [,1] [,2]
## [1,] 4.676300 12.67630
## [2,] 9.437908 17.43791
## [3,] 10.243334 18.24333
## [4,] 8.994307 16.99431
## [5,] 5.927719 13.92772
## [6,] 8.463890 16.46389
outside <- ci[,1] > mu | ci[,2] < mu
sum(outside)
## [1] 51
(M - sum(outside)) / M
## [1] 0.949