mthm506

87 views 5:39 am 0 Comments March 14, 2023

http://mthm506/COMM511:%20Statistical%20Data%20Modelling%20MTHM506/COMM511:%20Statistical%20Data%20Modelling%20Assessment%20-%20Individual%20Exercises%20Marks%20achieved%20in%20this%20assignment%20will%20contribute%20towards%2050%%20of%20the%20final%20module%20mark.%20You%20should%20attempt%20all%20questions%20on%20this%20sheet.%20Note%20that%20the%20questions%20are%20organised%20in%20the%20order%20we%20covered%20the%20topics,%20and%20not%20in%20order%20of%20difficulty.%20Therefore%20it%20is%20advised%20that%20you%20read%20through%20the%20questions%20first,%20and%20start%20working%20on%20those%20that%20you%20feel%20more%20comfortable%20with.%20Deadline:%20Noon%20(12pm),%20on%203rd%20March%202023%20You%20should%20submit%20one%20pdf%20via%20eBART%20containing%20your%20solutions%20-%20it%20should%20be%20written%20up%20using%20word%20processing%20software%20(e.g.%20LaTeX,%20R%20Markdown,%20or%20Word).%20Solutions%20are%20expected%20to%20be%20concise,%20well%20structured%20and%20well%20presented.%20Commented%20R%20code%20(e.g.%20%E2%80%98model%20%3C-%20glm(…)%E2%80%99)%20and%20the%20outcomes/plots%20should%20form%20part%20of%20your%20solutions.%20Do%20not%20display%20too%20much%20raw%20R%20output%20(e.g.%20don%E2%80%99t%20display%20the%20full%20output%20of%20%E2%80%98summary(model)%E2%80%99),%20but%20edit%20this%20down%20to%20the%20essentials.%20Ensure%20to%20include%20justification%20for%20each%20step%20of%20your%20analyses,%20providing%20comments%20alongside%20your%20R%20code%20to%20explain%20what%20you%20are%20doing%20and%20add%20appropriate%20titles%20and%20labelled%20axes%20to%20your%20plots.%20Hand%20written%20solutions%20will%20be%20accepted%20where%20mathematical%20descriptions%20are%20required,%20but%20a%20professional%20word%20processed%20submission%20is%20preferred.%20You%20are%20expected%20to%20work%20independently%20-%20strict%20disciplinary%20action%20will%20be%20taken%20for%20any%20plagiarism.%20Late%20submissions%20will%20also%20be%20penalised%20according%20the%20University%E2%80%99s%20late%20submission%20policy.%20The%20data%20required%20for%20this%20assignment%20datasets_exercises.RData%20can%20be%20downloaded%20from%20the%20ELE%20page%20and%20loaded%20into%20R%20using%20the%20load()%20function.%20Question%201%20The%20data%20frame%20nlmodel%20contains%20data%20on%20a%20response%20variable%20y%20and%20a%20single%20explanatory%20variable%20x.%20A%20scatter%20plot%20of%20y%20versus%20x%20suggests%20a%20strong%20non-linear%20relationship:%20200%20150%20100%2050%200.00%200.25%200.50%20x%200.75%201.00%20y%20Suppose%20for%20these%20data%20we%20wish%20to%20consider%20the%20model%20?%20%CE%B81xi%202?%20Yi%E2%88%BCN%20%CE%B8+x,%CF%83%202i%20i%20=%201,2,…,100,%20Yi%20independent%20(a)%20[1%20mark]%20Why%20can%E2%80%99t%20this%20model%20be%20fit%20using%20a%20linear%20(regression)%20model?%20(b)%20[2%20marks]%20Write%20down%20the%20likelihood%20L(%CE%B81,%20%CE%B82,%20%CF%832;%20y,%20x)%20and%20the%20log-likelihood%20l(%CE%B81,%20%CE%B82,%20%CF%832;%20y,%20x).%201%20(c)%20[1mark]WriteanRfunctionmylike()whichevaluatesthenegativelog-likelihood(i.e.%E2%88%92l(%CE%B81,%CE%B82,%CF%83;y,x))%20for%20any%20values%20of%20the%20three%20parameters.%20(d)%20[3%20marks]%20Use%20the%20R%20function%20nlm()%20in%20association%20with%20your%20function%20mylike()%20to%20numerically%20minimise%20the%20log-likelihood%20and%20report%20the%20maximum%20likelihood%20estimates%20for%20the%20model%20parameters.%20Provide%20some%20evidence%20of%20how%20you%20chose%20sensible%20starting%20values.%20(e)%20[2%20marks]%20Estimate%20the%20standard%20errors%20and%20construct%2099%%20confidence%20intervals%20for%20%CE%B81%20and%20%CE%B82.%20(f)%20[2%20marks]%20Test%20the%20hypothesis%20that%20%CE%B82%20=%200.08%20at%20the%2010%%20significance%20level%20(not%20using%20the%20confidence%20interval).%20(g)%20[4%20marks]%20Produce%20a%20plot%20of%20the%20associated%20mean%20relationship%20and%20the%20associated%2095%%20prediction%20intervals%20on%20a%20scatter%20plot%20of%20y%20versus%20x.%20Comment%20on%20the%20appropriateness%20of%20the%20model.%20Question%202%20The%20dataframe%20aids%20data%20relates%20to%20the%20number%20of%20quarterly%20AIDS%20cases%20in%20the%20UK,%20yi,%20from%20January%201983%20to%20March%201994.%20The%20variable%20cases%20is%20yi%20and%20date%20is%20time,%20symbolised%20here%20as%20xi.%20A%20scatter%20plot%20of%20yi%20versus%20xi%20shows%20an%20increasing%20trend%20in%20cases:%20500%20400%20300%20200%20100%200%2082.5%2085.0%2087.5%2090.0%2092.5%20Date%20Number%20of%20cases%20In%20this%20question%20we%20consider%20two%20competing%20models%20to%20describe%20the%20trend%20in%20the%20number%20of%20cases.%20Model%201%20is%20Yi%20%E2%88%BC%20Pois(%CE%BBi)%20and%20Model%202%20is%20log(%CE%BBi)%20=%20%CE%B20%20+%20%CE%B21xi%20Yi%20%E2%88%BCN(%CE%BCi,%CF%832)%20log(%CE%BCi)%20=%20%CE%B30%20+%20%CE%B31xi%20(a)%20[2%20marks]%20Comment%20on%20whether%20the%20proposed%20models%20are%20sensible%20in%20terms%20of%20the%20distribution%20and%20the%20relationship%20of%20x%20with%20the%20mean.%20(b)%20[3%20marks]%20Fit%20the%20two%20models%20in%20R%20and%20plot%20the%20estimated%20trends%20from%20each%20model%20(%CE%BB%CB%86i%20and%20%CE%BC%CB%86i)%20on%20top%20of%20the%20data%20with%20approximate%2095%%20confidence%20intervals%20around%20the%20mean.%20Comment%20on%20the%20validity%20of%20each%20model%20(based%20on%20the%20plot).%20(c)%20[2%20marks]%20Use%20an%20appropriate%20criterion%20to%20comment%20on%20which%20model%20is%20preferable.%20(d)%20[2%20marks]%20Produce%20the%20deviance%20residuals%20vs%20fitted%20values%20(%CE%BB%CB%86i%20and%20%CE%BC%CB%86i)%20plot%20for%20each%20model,%20comment%20appropriately%20and%20thus%20propose%20a%20way%20that%20the%20two%20models%20might%20be%20extended%20to%20improve%20the%20fit.%20(e)%20[4%20marks]%20Implement%20the%20proposed%20extensions%20to%20each%20model,%20to%20arrive%20at%20a%20final%20version%20for%20each%20of%20them%20(justified%20by%20appropriate%20hypothesis%20tests).%20(f)%20[8%20marks]%20On%20the%20basis%20of%20your%20answers%20(a)-(d),%20but%20also%20on%20arguments%20of%20model%20fit%20based%20on%20the%20deviance,%20comment%20on%20which%20(if%20any)%20of%20the%20two%20final%20models%20in%20(e)%20you%20would%20choose%20as%20the%20best.%20Mention%20at%20least%20one%20reason%20why%20either%20model%20is%20not%20ideal.%20(g)%20[4%20marks]%20Further%20extend%20your%20final%20Poisson%20model%20to%20a%20Negative%20Binomial%20model%20and%20comment%20on%20whether%20this%20model%20is%20preferable%20to%20the%20other%20tw