|
Exercise 2 (9'): Replicate Figure 12-12 on page 269 of the textbook by simulation. You are not allowed to draw directly from binomial distribution, such as using rbinom() in R. Note that your plot won't be exactly the same as in the textbook. Hint: 60 trials, 8 tosses each trial, as draws are independent, can make 60*8 uniform draws once at each value of p (p=0,0.05,...,0.95,1), then compare the draw with given p and set a value of 1 if the draw is larger than p.
这个已经有了matlab代码了,请帮忙换成r代码并画成图https://zhidao.baidu.com/question/1239334600587971259.html
2.Exercise 3: (16')
(1) Replicate Figure 12-13 on page 274 of the textbook by simulation using the same parameter values (N=1000, k=100,s=50). Note that your plot won't be exactly the same as in the textbook. (2) Drop the simplifed assumption that every token in the urn has the same probability of being drawn at each turn. Assume two types of users: frequent and infrequent (20% vs. 80%). Fix k=100 at each turn, draw 50 from a fixed group of 200 tokens and draw 50 from another fixed group of 800 tokens. Repeat the process for 31 turns and make the plot as Figure 12-13. What are the differences between the two plots? Please explain. 练习3:(16') (1)通过仿真使用相同的参数值(N = 1000,k = 100,s = 50)复制教科书第274页的图12-13。请注意,你的情节将不会在教科书中完全一样。 (2)放弃简单的假设,即每一个瓮中的标记在每一个回合中都具有相同的概率。假设两种类型的用户:频繁和不频繁(20%对80%)。每回合修正k = 100,从一个固定的200个标记组中抽取50个,并从另一个固定的800个标记组抽取50个。重复这个过程31圈,如图12-13所示。这两个地块有什么区别?请解释。 |