版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、Example A student attempts a multiple choice exam (options A to F for each question), but having done no work, selects his answers to each question by rolling a fair die (A = 1, B = 2, etc.). If the exam contains 100 questions, what is the probability of obtaining a mark below 20?,微快车微信营销 ,Simulatio
2、n,Now, let us simulate a large number of realisations of students using this random method of answering multiple choice questions. We still require the same Binomial distribution with n=100 and a= This can be done on R using the command rbinom.,For example, lets simulate 1000 students., xsim=rbinom(
3、1000,100,1/6) xsim 1 18 22 9 17 18 20 21 16 8 18 11 16 16 13 16 14 25 15 16 17 21 13 25 11 24 17 16 13 21 10 17 18 10 17 18 19 17 19 15 13 12 41 15 11 21 23 19 14 19 25 23 19 20 17 17 15 16 14 13 16 17 14 61 24 21 19 8 18 20 22 16 15 20 19 17 13 15 13 21 22 12 12 12 81 11 14 11 12 16 16 17 21 17 16
4、17 14 9 17 16 17 12 20 16 17 101 18 13 15 16 12 15 17 16 17 26 18 14 21 15 10 23 12 16 16 12 121 17 18 22 17 18 14 19 22 13 17 21 15 21 16 17 16 16 28 16 17 141 18 19 16 11 14 18 16 18 18 14 20 13 19 19 22 22 13 17 19 17 161 18 20 11 22 19 25 15 15 17 18 5 15 14 13 18 15 17 15 20 17 181 16 14 23 17
5、16 10 12 16 21 30 16 13 22 14 15 16 17 14 16 18 201 14 20 16 19 25 14 15 24 22 19 15 17 22 10 20 13 10 15 14 22 221 17 12 16 19 20 17 15 21 14 13 21 11 19 9 21 22 16 13 13 12 241 14 13 18 8 14 18 10 16 10 12 21 18 15 17 16 8 19 17 11 18 261 23 17 20 16 12 20 11 16 22 17 16 13 22 20 15 15 20 17 22 14
6、 281 18 23 18 20 20 16 19 16 15 19 18 17 14 22 15 24 17 15 17 22,301 18 22 10 19 24 21 16 14 11 14 20 15 21 11 17 16 20 19 13 14 321 17 17 19 15 17 13 18 23 16 12 25 13 13 21 19 16 20 27 19 18 341 18 24 15 23 13 13 14 15 23 13 19 15 11 19 17 12 15 15 17 14 361 18 20 17 13 16 14 13 20 18 15 18 16 17
7、20 14 19 21 12 13 17 381 22 17 19 16 14 18 16 18 12 16 13 15 16 9 15 16 18 22 14 16 401 14 17 12 16 21 16 21 13 14 19 18 18 16 19 17 17 17 13 17 11 421 16 16 13 10 26 12 20 17 11 19 18 12 15 14 14 20 15 15 15 11 441 18 23 20 23 13 12 18 22 12 16 13 21 22 14 18 21 17 12 19 16 461 17 18 15 22 22 20 15
8、 16 13 12 19 22 16 20 19 19 16 8 15 12 481 29 26 19 16 20 15 11 22 15 20 21 14 16 13 17 15 10 13 17 12 501 18 20 17 14 13 19 23 11 27 19 17 16 17 20 21 15 20 20 21 19 521 21 16 13 21 16 19 13 9 10 20 12 18 14 13 18 19 22 19 21 18 541 6 17 17 19 19 22 23 18 13 12 17 16 21 16 18 21 19 13 22 19 561 20
9、17 18 15 17 15 15 10 18 13 23 17 14 23 22 10 18 11 11 18 581 16 17 14 13 9 12 14 14 21 23 24 19 12 15 17 18 11 14 19 19 601 19 16 17 13 13 15 17 18 17 13 9 19 18 22 17 13 14 22 13 23 621 23 19 19 16 24 14 17 18 17 13 16 12 7 15 17 16 18 22 19 15 641 16 18 18 13 20 18 12 6 15 11 16 19 12 13 11 17 11
10、15 11 19,661 17 16 16 21 12 18 20 19 16 14 18 17 16 14 11 17 17 16 17 17 681 17 18 16 18 12 18 18 20 19 13 12 16 14 13 13 6 15 12 19 14 701 20 17 16 14 21 19 15 26 17 20 12 24 13 11 19 21 18 13 9 16 721 9 16 17 16 15 12 11 21 21 13 19 13 13 16 11 17 15 19 22 19 741 11 13 14 16 20 15 16 12 18 14 12 1
11、4 21 12 23 21 19 10 24 17 761 17 19 19 15 18 12 14 14 14 20 12 20 12 21 19 20 21 20 17 18 781 15 12 16 23 16 16 19 15 12 14 21 25 12 19 20 22 17 16 21 20 801 23 24 17 20 17 19 14 22 20 25 10 12 15 16 7 14 14 18 22 10 821 15 22 23 18 12 10 14 18 15 15 18 10 21 11 20 15 20 10 13 16 841 16 17 22 19 19
12、16 8 20 17 13 21 16 25 16 13 17 14 17 19 21 861 17 19 14 22 20 18 14 19 17 23 20 18 14 11 16 18 26 24 24 18 881 21 16 23 20 14 16 15 13 14 11 12 13 14 16 18 17 16 17 13 20 901 22 8 17 17 16 16 14 22 17 18 18 21 15 11 20 21 18 15 19 21 921 16 22 14 12 16 20 16 21 11 13 19 14 23 12 12 17 14 15 26 17 9
13、41 18 14 21 17 14 24 21 12 21 13 20 22 11 20 10 16 16 15 19 13 961 16 15 16 17 9 14 11 12 19 17 16 15 21 14 15 14 15 17 15 16 981 19 11 15 17 17 17 11 18 21 14 15 17 18 16 11 22 19 16 14 15,It makes sense now to look at properties of these 1000 simulations which have been placed in the vector “xsim”
14、., mean(xsim) 1 16.624 median(xsim) 1 17 sd(xsim) 1 3.778479 var(xsim) 1 14.2769 ,Now compare the actual values from the simulations, with the theoretical values from the probability distribution. SIMULATION THEORETICAL MEAN16.62416.66667 VARIANCE14.276913.88889,A full summary of the results of the
15、simulation is given with:, table(xsim) xsim 5 6 7 8 9 10 11 12 13 14 15 16 17 1 3 2 7 10 21 40 57 72 80 82 118 118 18 19 20 21 22 23 24 25 26 27 28 29 30 85 83 61 55 46 25 14 9 6 2 1 1 1 ,A Histogram can also be plotted of this:, hist(xsim),Notice that a BARPLOT of xsim does NOT produce a useful gra
16、ph!, barplot(xsim),A barplot of the TABLE of xsim does work,though., barplot(table(xsim),Poisson Distribution,The Poisson distribution is used to model the number of events occurring within a given time interval. The formula for the Poisson probability density (mass) function is is the shape paramet
17、er which indicates the average number of events in the given time interval.,Some events are rather rare - they dont happen that often. For instance, car accidents are the exception rather than the rule. Still, over a period of time, we can say something about the nature of rare events. An example is
18、 the improvement of traffic safety, where the government wants to know whether seat belts reduce the number of death in car accidents. Here, the Poisson distribution can be a useful tool to answer questions about benefits of seat belt use.,Other phenomena that often follow a Poisson distribution are
19、 death of infants, the number of misprints in a book, the number of customers arriving, and the number of activations of a Geiger counter.,The distribution was derived by the French mathematician Simon Poisson in 1837, and the first application was the description of the number of deaths by horse ki
20、cking in the Prussian army.,Example Arrivals at a bus-stop follow a Poisson distribution with an average of 4.5 every quarter of an hour. Obtain a barplot of the distribution (assume a maximum of 20 arrivals in a quarter of an hour) and calculate the probability of fewer than 3 arrivals in a quarter
21、 of an hour.,The probabilities of 0 up to 2 arrivals can be calculated directly from the formula,with =4.5,So p(0) = 0.01111,Similarly p(1)=0.04999 and p(2)=0.11248 So the probability of fewer than 3 arrivals is 0.01111+ 0.04999 + 0.11248 =0.17358,R Code,As with the Binomial distribution, the codes
22、dpois and ppois will do the calculations for you., x=dpois(0:20,4.5) x 1 1.110900e-02 4.999048e-02 1.124786e-01 1.687179e-01 1.898076e-01 6 1.708269e-01 1.281201e-01 8.236295e-02 4.632916e-02 2.316458e-02 11 1.042406e-02 4.264389e-03 1.599146e-03 5.535504e-04 1.779269e-04 16 5.337808e-05 1.501258e-0
23、5 3.973919e-06 9.934798e-07 2.352979e-07 21 5.294202e-08 , barplot(x,names=0:20),Now check that ppois gives the same answer (ppois is a cumulative distribution)., ppois(2,4.5) 1 0.1735781 ,Consider a collection of graphs for different values of ,=3,=4,=5,=6,=10,In the last case, the probability of 2
24、0 arrivals is no longer negligible, so values up to, say, 30 would have to be considered.,Properties of Poisson,The mean and variance are both equal to . The sum of independent Poisson variables is a further Poisson variable with mean equal to the sum of the individual means. As well as cropping up in the situations already mentioned,
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 验收小组奖惩制度范本
- 警务团队奖惩制度汇编
- 初中实习教师奖惩制度
- 车险销售团队奖惩制度
- 原辅材料出库奖惩制度
- 补习班大拇指奖惩制度
- 护理实习生教学奖惩制度
- 一年级家长奖惩制度细则
- 电力施工员工奖惩制度
- 特教教师考核奖惩制度
- 公司月度工作汇报管理制度
- 2025-2030新型肥料产业发展分析及政府战略规划实施研究报告
- JG/T 100-1999塔式起重机操作使用规程
- 中国精神障碍分类与诊断标准第3版
- 佣金结算表格协议书
- 抽象绘画美术课件
- 2025年中国南水北调集团新能源投资有限公司招聘笔试参考题库附带答案详解
- 2025新科普版英语七年级下单词默写单
- 2025年高考数学备考立体几何压轴题(八省联考新考向)
- 《电力建设工程施工安全管理导则》(NB∕T 10096-2018)
- 2024年中望CAD绘图培训教程
评论
0/150
提交评论