讲解:MATH4007、STATISTICS、R、RMatlab|SQL

MATH4007 COMPUTATIONAL STATISTICSAssessed Coursework 1 — 2019/2020The deadline for this work is 3pm, Wednesday 11 December 2019, to be submitted viathe “Coursework 1 Submission” link on Moodle. Unauthorised late submission will be penalisedby 5% of the full mark per day. Work submitted more than one week late will receive zero marks.All components (see below) must be submitted by the deadline for the work to be consideredon time. You are reminded to familiarise yourself with the guidelines concerning plagiarism inassessed coursework (see the student handbook), and note that this applies equally to computercode as it does to written work. The submission should contain:1. A pdf file containing any computational results (plots/relevant output) and discussion. Thiscan be produced using e.g. R Markdown, or by copying output into a Word document.Please convert any documents to pdf for uploading.2. A pdf of your theoretical working. A scan of handwritten work is fine, but you could alsotypeset using Latex if you prefer. If it’s more convenient, you can combine this and theabove part into one, e.g. if you wish to put everything in one Latex document, but this isnot required.3. An R script file, i.e. with a .r extension containing your R code. This should be clearlyformatted, and include brief comments so that a reader can understand what it is doing.The code should also be ready to run without any further modification by the user, andshould reproduce your results (approximately, for simulation-based results).Please make sure that all required working, results, details of implementation and discussion arecontained in components 1 and 2 of the above list and not in the script file. The script filewill only be used for verification of results. The exception is for the R code itself, whereby it issufficient to say “refer to script file” where a question asks you to write R code.1. Data y = (y1, . . . , yn) are assumed to come from a N(µ, σ2) distribution. A Bayesiananalysis is to be performed for the parameters µ and σ, which are assumed to haveindependent prior distributions with µ ∼ N(µ0, τ 20) and p(σ) ∝1σ, where µ0MATH4007作业代做、代写STATISTICS作业、代做R课程设计作业、R编程语言作业代做 调试Matlab程序|代 and τ20are known constants. (The prior on σ corresponds to a “uniform” prior on log(σ), whichis a standard way to specify a noninformative prior on σ.)(a) Verify that the posterior distribution is.(b) The observed data are−1.97 0.46 1.14 − 1.63 2.95 − 3.23 − 3.18 0.37 0.45 − 2.80.The values µ0 = 0 and τ0 = 100 are chosen to reflect vague prior information aboutµ. Use the 2-d mid-ordinate rule to calculate K.(c) The marginal posterior distribution of µ isp(µ|y) = Z ∞0p(µ, σ|y)dσ,which is not available in closed form. Give full details of Laplace’s method to computep(µ|y) at a particular point µ.(d) Write a function in R to compute p(µ|y) at a particular point µ using Laplace’s methodderived in (c).(e) Write a function in R to perform the Golden-ratio method to find the mode of p(µ|y),using your R function from part (d) as the function to optimize.(f) Hence, find the mode of p(µ|y) to an accuracy of 1 decimal place.[20]2. A random variable Z is said to follow a log-normal distribution with parameter β if Z =exp(X), where X ∼ N(0, β). The density of a random variable Z which follows a Gamma distribution with parametersa and b isp(z) ∝ za−1exp{−bz}.Prove that the marginal distribution of λ is the Gamma distribution with parametersa = 10 and b = 10.(b) Prove that the conditional distribution of Y given λ, p(y|λ), is log-normal withparameter 1λ.(c) Describe how these results can be used to simulate from the marginal distributionp(y).(d) Hence, simulate 10000 samples from the marginal distribution p(y). Use your samplesto estimate the mean and variance of the distribution, and P(Y > 10).(e) The true marginal pdf of Y iswhere k = 0.389. Plot a histogram of your samples, scaled to have area 1. Overlaythe true pdf and comment on the agreement.Continued overleaf2(f) The marginal distribution of Y is of a type commonly used in reliability analysis,where “unusually large” observations have a non-negligible probability content. Withreference to your histogram, explain why this distribution might be useful for modellingsuch data.[20]3转自:http://www.6daixie.com/contents/18/4571.html

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 202,056评论 5 474
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 84,842评论 2 378
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 148,938评论 0 335
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,296评论 1 272
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,292评论 5 363
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,413评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 37,824评论 3 393
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,493评论 0 256
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,686评论 1 295
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,502评论 2 318
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,553评论 1 329
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,281评论 4 318
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 38,820评论 3 305
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,873评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,109评论 1 258
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 42,699评论 2 348
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,257评论 2 341

推荐阅读更多精彩内容