{"id":6007,"date":"2016-12-28T15:25:05","date_gmt":"2016-12-28T21:25:05","guid":{"rendered":"http:\/\/www.ssc.wisc.edu\/~jfrees\/?page_id=6007"},"modified":"2016-12-28T16:10:48","modified_gmt":"2016-12-28T22:10:48","slug":"parametric-maximum-likelihood-estimation-with-grouped-data-soa-exam-c-question-276","status":"publish","type":"page","link":"https:\/\/users.ssc.wisc.edu\/~ewfrees\/loss-data-analytics\/chapter-3-modeling-loss-severity\/theory-and-practice-exercises\/parametric-maximum-likelihood-estimation-with-grouped-data-soa-exam-c-question-276\/","title":{"rendered":"Parametric Maximum Likelihood Estimation with Grouped Data: C 276"},"content":{"rendered":"<div class=\"scbb-content-box scbb-content-box-gray\">\n<ul>\n<li>A. The Question (SoA Exam C # 276)<\/li>\n<li>B. Solution via Hand Calculations<\/li>\n<li>C. Solution (and Extensions) using <strong>R<\/strong><\/li>\n<\/ul>\n<p><\/p><\/div>\n<h2>A. The Question (SoA Exam C # 276)<\/h2>\n<p>For a group of policies, you are given:<br \/>\n&#8211;   (i) Losses follow the distribution function<br \/>\n        $$ F(x) = 1 &#8211; \\theta \/ x, \\ \\ \\ \\  x > 0.$$<br \/>\n&#8211;   (ii) A sample of 20 losses resulted in the following: $$<br \/>\n        {\\small<br \/>\n        \\begin{matrix}<br \/>\n        \\begin{array}{c|c}<br \/>\n        \\text{Interval} &#038; \\text{Number of Losses}  \\\\ \\hline<br \/>\n        (0, 10] &#038; 9 \\\\<br \/>\n        (10, 25] &#038; 6 \\\\<br \/>\n        (25, \\infty) &#038; 5  \\\\ \\hline<br \/>\n        \\end{array}<br \/>\n        \\end{matrix}<br \/>\n        }<br \/>\n        $$<br \/>\nCalculate the maximum likelihood estimate of $\\theta$ .<\/p>\n<h2>B. Solution via Hand Calculations <\/h2>\n<p><a id=\"displayText276\" href=\"javascript:toggle('toggleText276','displayText276');\"><i>Solution<\/i><\/a><\/p>\n<div id=\"toggleText276\" style=\"display: none\">\n<hr \/>\n<p>This is question involves <em>interval censored<\/em>, also known as <em>grouped*<\/em>, data. Suppose that there are $n_j$ observations in the interval $(c_{j-1},c_j)$, over $j=1,\\ldots, k$ intervals. Then, an expression for the logarithmic likelihood is<br \/>\n$$L(\\theta) = \\sum_{j=1}^k n_j \\ln \\left\\{ F(c_j) &#8211; F(c_{j-1}) \\right\\}, $$<br \/>\nwhere $F(\\cdot)$ is the distribution function and $\\theta$ is the (vector of) parameters that describes $F(\\cdot)$. The maximum likelihood estimator $\\hat{\\theta}$ is that value of $\\theta$ that maximizes $L(\\theta)$. In many problems, this is done by taking a derivative of $L(\\theta)$ with respect to $\\theta$, setting it equal to zero, and solving for $\\theta$.<\/p>\n<p>For this problem, there are $k=3$ intervals. Evaluating the distribution function at the two cut-points, we have<br \/>\n$$F(10)= 1 &#8211; \\frac{\\theta}{10} \\ \\ \\ F(25) =1 &#8211; \\frac{\\theta}{25} .$$<br \/>\nNote also that $F(0)=0$ and $F(\\infty)=1$. With this, an expression for the log-likelihood is $$L(\\theta) =<br \/>\n9 \\ln \\left\\{ (1 &#8211; \\frac{\\theta}{10}) &#8211; 0 \\right\\} +<br \/>\n6 \\ln \\left\\{(1 &#8211; \\frac{\\theta}{15}) &#8211; (1 &#8211; \\frac{\\theta}{10}) \\right\\} +<br \/>\n5 \\ln \\left\\{ 1  &#8211; (1 &#8211; \\frac{\\theta}{15}) \\right\\}  \\\\<br \/>\n= 9 \\ln (1 &#8211; \\frac{\\theta}{10})  +<br \/>\n6 \\ln (\\theta (\\frac{1}{10}-\\frac{1}{25})<br \/>\n5 \\ln (\\frac{\\theta}{25}) \\\\<br \/>\n= 9 \\ln (1 &#8211; \\frac{\\theta}{10})  +<br \/>\n6 \\ln (\\theta (0.04) +<br \/>\n5 \\ln (\\frac{\\theta}{25})<br \/>\n$$ Taking a derivative of $L(\\theta)$ with respect to $\\theta$ yields<br \/>\n$$\\frac{\\partial}{\\partial \\theta} L(\\theta) =<br \/>\n9 \\frac{1\/10}{1-\\theta\/10})  + 6 \\frac{1}{\\theta} + 5 \\frac{1}{\\theta}<br \/>\n= -\\frac{9}{10-\\theta} + \\frac{11}{\\theta}<br \/>\n$$ Equating this to zero yields $$<br \/>\n\\frac{9}{10-\\theta} = \\frac{11}{\\theta} \\ \\ \\ => 9 \\theta = 11 (10-\\theta) => 20 \\theta = 110<br \/>\n$$ so that $\\hat{\\theta} = 5.5$.<\/p>\n<hr \/>\n<\/div>\n<h2>C. Solution (and Extensions) using <strong>R<\/strong><\/h2>\n<h2><strong>R<\/strong>  Solution<\/h2>\n<pre>\r\n##Log Likelihood function \r\nlikgrp &lt;- function(theta) {\r\n  loglike &lt;-log(((1-(theta\/10))^9)*(((theta\/10)-(theta\/25))^6)* (((theta\/25))^5))\r\n  return(-sum(loglike))\r\n}\r\n#  \"optim\" is a general purpose minimization function\r\ngrplik &lt;- optim(c(1),likgrp,method=c(\"L-BFGS-B\"),hessian=TRUE)\r\n#Estimates - Answer \"B\" on SoA Problem\r\ngrplik\\$par\r\n<\/pre>\n<p>    ## [1] 5.5<\/p>\n<p>That is enough for the SoA problem. Naturally, we can go a bit further.<\/p>\n<h2><strong>R<\/strong> Extensions<\/h2>\n<pre>\r\n#standard error\r\nsqrt(diag(solve(grplik\\$hessian)))\r\n<\/pre>\n<p>    ## [1] 1.11243<\/p>\n<pre>\r\n#t-statistics\r\n(tstat = grplik\\$par\/sqrt(diag(solve(grplik\\$hessian))) )\r\n<\/pre>\n<p>    ## [1] 4.944132<\/p>\n<pre>\r\n#Plot of Negative Log-Likelihood function \r\nvllh = Vectorize(likgrp,\"theta\")\r\ntheta=seq(0,10, by=0.01)\r\nplot(theta, vllh(theta), pch=16, main =\"Negative Log-Likelihood function\" , cex=.25, \r\n     xlab=expression(theta), ylab=expression(paste(\"L(\",theta,\")\")))\r\n<\/pre>\n<p><a href=\"http:\/\/www.ssc.wisc.edu\/~jfrees\/wp-content\/uploads\/2016\/12\/FigC276Likelihood.png\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.ssc.wisc.edu\/~jfrees\/wp-content\/uploads\/2016\/12\/FigC276Likelihood-300x214.png\" alt=\"figc276likelihood\" width=\"300\" height=\"214\" class=\"alignnone size-medium wp-image-6022\" srcset=\"https:\/\/users.ssc.wisc.edu\/~ewfrees\/wp-content\/uploads\/2016\/12\/FigC276Likelihood-300x214.png 300w, https:\/\/users.ssc.wisc.edu\/~ewfrees\/wp-content\/uploads\/2016\/12\/FigC276Likelihood.png 672w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><div class=\"alignleft\"><a href=\"https:\/\/users.ssc.wisc.edu\/~ewfrees\/loss-data-analytics\/chapter-3-modeling-loss-severity\/theory-and-practice-exercises\/\" title=\"Theory and Practice Exercises\">&#9668 Previous page<\/a><\/div><div class=\"alignright\"><a href=\"https:\/\/users.ssc.wisc.edu\/~ewfrees\/loss-data-analytics\/loss-data-analytics-model-selection\/\" title=\"Model Selection Guided Tutorials\">Next page &#9658<\/a><\/div><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A. The Question (SoA Exam C # 276) For a group of policies, you are given: &#8211; (i) Losses follow the distribution function $$ F(x) = 1 &#8211; \\theta \/ x, \\ \\ \\ \\ &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":6026,"menu_order":1,"comment_status":"closed","ping_status":"closed","template":"","meta":{"jetpack_post_was_ever_published":false},"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/P8cLPd-1yT","acf":[],"_links":{"self":[{"href":"https:\/\/users.ssc.wisc.edu\/~ewfrees\/wp-json\/wp\/v2\/pages\/6007"}],"collection":[{"href":"https:\/\/users.ssc.wisc.edu\/~ewfrees\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/users.ssc.wisc.edu\/~ewfrees\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/users.ssc.wisc.edu\/~ewfrees\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/users.ssc.wisc.edu\/~ewfrees\/wp-json\/wp\/v2\/comments?post=6007"}],"version-history":[{"count":17,"href":"https:\/\/users.ssc.wisc.edu\/~ewfrees\/wp-json\/wp\/v2\/pages\/6007\/revisions"}],"predecessor-version":[{"id":6036,"href":"https:\/\/users.ssc.wisc.edu\/~ewfrees\/wp-json\/wp\/v2\/pages\/6007\/revisions\/6036"}],"up":[{"embeddable":true,"href":"https:\/\/users.ssc.wisc.edu\/~ewfrees\/wp-json\/wp\/v2\/pages\/6026"}],"wp:attachment":[{"href":"https:\/\/users.ssc.wisc.edu\/~ewfrees\/wp-json\/wp\/v2\/media?parent=6007"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}