From 364fac9f37d7d5ab46079f36fec0a68220744fed Mon Sep 17 00:00:00 2001 From: Nikhil Woodruff <35577657+nikhilwoodruff@users.noreply.github.com> Date: Thu, 19 Oct 2023 16:20:14 +0100 Subject: [PATCH 1/3] Add @Kittyaoooo's PC docs --- changelog_entry.yaml | 4 + .../programs/gov/dwp/pension-credit.ipynb | 2569 +++++++++++++++++ 2 files changed, 2573 insertions(+) create mode 100644 docs/book/programs/gov/dwp/pension-credit.ipynb diff --git a/changelog_entry.yaml b/changelog_entry.yaml index e69de29bb..e6e21caa3 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -0,0 +1,4 @@ +- bump: minor + changes: + added: + - Pension Credit documentation page. diff --git a/docs/book/programs/gov/dwp/pension-credit.ipynb b/docs/book/programs/gov/dwp/pension-credit.ipynb new file mode 100644 index 000000000..4ea381017 --- /dev/null +++ b/docs/book/programs/gov/dwp/pension-credit.ipynb @@ -0,0 +1,2569 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "8d07409a", + "metadata": {}, + "source": [ + "# Pension Credit\n", + "\n", + "Pension Credit is a means-tested benefit payment administered by the Department for Work and Pensions (DWP) in the United Kingdom. It was introduced to provide financial assistance to pensioners and ensure they have a minimum income level. Pension Credit combines two main elements: Guarantee Credit and Savings Credit.\n", + "\n", + "* Guarantee Credit: Intended for pensioners who have reached the qualifying age and have a low income. It tops up \n", + " their weekly income to a guaranteed minimum level, which varies based on individual circumstances.\n", + "* Savings Credit: Designed for pensioners who have saved for their retirement or have a modest income. It provides \n", + " additional support to those who have some savings or a second pension.\n", + "\n", + "\n", + "Pension Credit parameters can be found in `policyengine_uk/parameters/gov/dwp/pension_credit` and logic in `policyengine_uk/variables/dwp/pension_credit.py`.\n", + "\n", + "## Legislation\n", + "\n", + "The legal framework for Guarantee Credit is primarily defined in the legislation provided on the [The State Pension Credit Regulations 2002](https://www.legislation.gov.uk/uksi/2002/1792/regulation/6) legislation website. \n", + "The legal framework for Savings Credit is primarily defined in the legislation provided on the [State Pension Credit Act 2002](https://www.legislation.gov.uk/ukpga/2002/16/section/3) legislation website. \n", + "\n", + "## Pension Credit Rate Changes\n", + "\n", + "Some key components of Guarantee Credit include:\n", + "\n", + "* Additional Minimum Guarantee\n", + "* Carer addition\n", + "* Child-related addition\n", + "* Disabled-child minimum guarantee\n", + "* Severe disabled-child minimum guarantee\n", + "* Severe disabled-adult minimum guarantee\n", + "\n", + "\n", + "The table below shows some of the rates covered by PolicyEngine-UK. " + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "dbb3de6d", + "metadata": { + "scrolled": true, + "tags": [ + "hide-input" + ] + }, + "outputs": [ + { + "data": { + "text/html": [ + "
element | \n", + "Carer | \n", + "Child | \n", + "Disabled child | \n", + "Severe disabled adult | \n", + "Severe disabled child | \n", + "
---|---|---|---|---|---|
date | \n", + "\n", + " | \n", + " | \n", + " | \n", + " | \n", + " |
2019-01-01 | \n", + "\n", + " | \n", + " | 29.02 | \n", + "64.30 | \n", + "\n", + " |
2020-01-01 | \n", + "36.0 | \n", + "53.34 | \n", + "29.02 | \n", + "65.85 | \n", + "88.34 | \n", + "
2021-01-01 | \n", + "37.5 | \n", + "54.32 | \n", + "29.52 | \n", + "66.95 | \n", + "92.12 | \n", + "
2022-01-01 | \n", + "37.7 | \n", + "54.6 | \n", + "29.66 | \n", + "67.30 | \n", + "92.54 | \n", + "
2023-01-01 | \n", + "38.85 | \n", + "56.35 | \n", + "30.58 | \n", + "69.40 | \n", + "95.48 | \n", + "
2024-01-01 | \n", + "38.85 | \n", + "56.35 | \n", + "30.58 | \n", + "69.40 | \n", + "95.48 | \n", + "
element | \n", + "Income threshold (couple) | \n", + "Income threshold (single) | \n", + "
---|---|---|
date | \n", + "\n", + " | \n", + " |
2015-01-01 | \n", + "\n", + " | \n", + " |
2016-01-01 | \n", + "201.8 | \n", + "126.5 | \n", + "
2017-01-01 | \n", + "212.97 | \n", + "133.82 | \n", + "
2018-01-01 | \n", + "218.42 | \n", + "137.35 | \n", + "
2019-01-01 | \n", + "223.82 | \n", + "140.67 | \n", + "
2020-01-01 | \n", + "229.67 | \n", + "144.38 | \n", + "
2021-01-01 | \n", + "239.17 | \n", + "150.47 | \n", + "
2022-01-01 | \n", + "244.12 | \n", + "153.7 | \n", + "
0?[0]:[]);if(o.enter().append(\"g\").classed(f.containerClassName,!0).style(\"cursor\",\"pointer\"),o.exit().each((function(){n.select(this).selectAll(\"g.\"+f.headerGroupClassName).each(a)})).remove(),0!==r.length){var l=o.selectAll(\"g.\"+f.headerGroupClassName).data(r,p);l.enter().append(\"g\").classed(f.headerGroupClassName,!0);for(var u=s.ensureSingle(o,\"g\",f.dropdownButtonGroupClassName,(function(t){t.style(\"pointer-events\",\"all\")})),c=0;c 90&&i.log(\"Long binary search...\"),h-1},e.sorterAsc=function(t,e){return t-e},e.sorterDes=function(t,e){return e-t},e.distinctVals=function(t){var r,n=t.slice();for(n.sort(e.sorterAsc),r=n.length-1;r>-1&&n[r]===o;r--);for(var i,a=n[r]-n[0]||1,s=a/(r||1)/1e4,l=[],u=0;u<=r;u++){var c=n[u],f=c-i;void 0===i?(l.push(c),i=c):f>s&&(a=Math.min(a,f),l.push(c),i=c)}return{vals:l,minDiff:a}},e.roundUp=function(t,e,r){for(var n,i=0,a=e.length-1,o=0,s=r?0:1,l=r?1:0,u=r?Math.ceil:Math.floor;i0&&(n=1),r&&n)return t.sort(e)}return n?t:t.reverse()},e.findIndexOfMin=function(t,e){e=e||a;for(var r,n=1/0,i=0;il?r.y-l:0;return Math.sqrt(u*u+f*f)}for(var p=h(u);p;){if((u+=p+r)>f)return;p=h(u)}for(p=h(f);p;){if(u>(f-=p+r))return;p=h(f)}return{min:u,max:f,len:f-u,total:c,isClosed:0===u&&f===c&&Math.abs(n.x-i.x)<.1&&Math.abs(n.y-i.y)<.1}},e.findPointOnPath=function(t,e,r,n){for(var i,a,o,s=(n=n||{}).pathLength||t.getTotalLength(),l=n.tolerance||.001,u=n.iterationLimit||30,c=t.getPointAtLength(0)[r]>t.getPointAtLength(s)[r]?-1:1,f=0,h=0,p=s;f0?p=i:h=i,f++}return a}},81697:function(t,e,r){\"use strict\";var n=r(92770),i=r(84267),a=r(25075),o=r(21081),s=r(22399).defaultLine,l=r(73627).isArrayOrTypedArray,u=a(s);function c(t,e){var r=t;return r[3]*=e,r}function f(t){if(n(t))return u;var e=a(t);return e.length?e:u}function h(t){return n(t)?t:1}t.exports={formatColor:function(t,e,r){var n,i,s,p,d,v=t.color,g=l(v),y=l(e),m=o.extractOpts(t),x=[];if(n=void 0!==m.colorscale?o.makeColorScaleFuncFromTrace(t):f,i=g?function(t,e){return void 0===t[e]?u:a(n(t[e]))}:f,s=y?function(t,e){return void 0===t[e]?1:h(t[e])}:h,g||y)for(var b=0;b
/i;e.BR_TAG_ALL=/
/gi;var _=/(^|[\\s\"'])style\\s*=\\s*(\"([^\"]*);?\"|'([^']*);?')/i,w=/(^|[\\s\"'])href\\s*=\\s*(\"([^\"]*)\"|'([^']*)')/i,T=/(^|[\\s\"'])target\\s*=\\s*(\"([^\"\\s]*)\"|'([^'\\s]*)')/i,k=/(^|[\\s\"'])popup\\s*=\\s*(\"([\\w=,]*)\"|'([\\w=,]*)')/i;function A(t,e){if(!t)return null;var r=t.match(e),n=r&&(r[3]||r[4]);return n&&L(n)}var M=/(^|;)\\s*color:/;e.plainText=function(t,e){for(var r=void 0!==(e=e||{}).len&&-1!==e.len?e.len:1/0,n=void 0!==e.allowedTags?e.allowedTags:[\"br\"],i=t.split(m),a=[],o=\"\",s=0,l=0;l
\"+l;e.text=u}(t,o,r,u):\"log\"===c?function(t,e,r,n,a){var o=t.dtick,l=e.x,u=t.tickformat,c=\"string\"==typeof o&&o.charAt(0);if(\"never\"===a&&(a=\"\"),n&&\"L\"!==c&&(o=\"L3\",c=\"L\"),u||\"L\"===c)e.text=bt(Math.pow(10,l),t,a,n);else if(i(o)||\"D\"===c&&s.mod(l+.01,1)<.1){var f=Math.round(l),h=Math.abs(f),p=t.exponentformat;\"power\"===p||mt(p)&&xt(f)?(e.text=0===f?1:1===f?\"10\":\"10\"+(f>1?\"\":P)+h+\"\",e.fontSize*=1.25):(\"e\"===p||\"E\"===p)&&h>2?e.text=\"1\"+p+(f>0?\"+\":P)+h:(e.text=bt(Math.pow(10,l),t,\"\",\"fakehover\"),\"D1\"===o&&\"y\"===t._id.charAt(0)&&(e.dy-=e.fontSize/6))}else{if(\"D\"!==c)throw\"unrecognized dtick \"+String(o);e.text=String(Math.round(Math.pow(10,s.mod(l,1)))),e.fontSize*=.75}if(\"D1\"===t.dtick){var d=String(e.text).charAt(0);\"0\"!==d&&\"1\"!==d||(\"y\"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(l<0?.5:.25)))}}(t,o,0,u,v):\"category\"===c?function(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=\"\"),e.text=String(r)}(t,o):\"multicategory\"===c?function(t,e,r){var n=Math.round(e.x),i=t._categories[n]||[],a=void 0===i[1]?\"\":String(i[1]),o=void 0===i[0]?\"\":String(i[0]);r?e.text=o+\" - \"+a:(e.text=a,e.text2=o)}(t,o,r):Dt(t)?function(t,e,r,n,i){if(\"radians\"!==t.thetaunit||r)e.text=bt(e.x,t,i,n);else{var a=e.x/180;if(0===a)e.text=\"0\";else{var o=function(t){function e(t,e){return Math.abs(t-e)<=1e-6}var r=function(t){for(var r=1;!e(Math.round(t*r)/r,t);)r*=10;return r}(t),n=t*r,i=Math.abs(function t(r,n){return e(n,0)?r:t(n,r%n)}(n,r));return[Math.round(n/i),Math.round(r/i)]}(a);if(o[1]>=100)e.text=bt(s.deg2rad(e.x),t,i,n);else{var l=e.x<0;1===o[1]?1===o[0]?e.text=\"π\":e.text=o[0]+\"π\":e.text=[\"\",o[0],\"\",\"⁄\",\"\",o[1],\"\",\"π\"].join(\"\"),l&&(e.text=P+e.text)}}}}(t,o,r,u,v):function(t,e,r,n,i){\"never\"===i?i=\"\":\"all\"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i=\"hide\"),e.text=bt(e.x,t,i,n)}(t,o,0,u,v),n||(t.tickprefix&&!d(t.showtickprefix)&&(o.text=t.tickprefix+o.text),t.ticksuffix&&!d(t.showticksuffix)&&(o.text+=t.ticksuffix)),t.labelalias&&t.labelalias.hasOwnProperty(o.text)){var g=t.labelalias[o.text];\"string\"==typeof g&&(o.text=g)}if(\"boundaries\"===t.tickson||t.showdividers){var y=function(e){var r=t.l2p(e);return r>=0&&r<=t._length?e:null};o.xbnd=[y(o.x-.5),y(o.x+t.dtick-.5)]}return o},q.hoverLabelText=function(t,e,r){r&&(t=s.extendFlat({},t,{hoverformat:r}));var n=Array.isArray(e)?e[0]:e,i=Array.isArray(e)?e[1]:void 0;if(void 0!==i&&i!==n)return q.hoverLabelText(t,n,r)+\" - \"+q.hoverLabelText(t,i,r);var a=\"log\"===t.type&&n<=0,o=q.tickText(t,t.c2l(a?-n:n),\"hover\").text;return a?0===n?\"0\":P+o:o};var yt=[\"f\",\"p\",\"n\",\"μ\",\"m\",\"\",\"k\",\"M\",\"G\",\"T\"];function mt(t){return\"SI\"===t||\"B\"===t}function xt(t){return t>14||t<-15}function bt(t,e,r,n){var a=t<0,o=e._tickround,l=r||e.exponentformat||\"B\",u=e._tickexponent,c=q.getTickFormat(e),f=e.separatethousands;if(n){var h={exponentformat:l,minexponent:e.minexponent,dtick:\"none\"===e.showexponent?e.dtick:i(t)&&Math.abs(t)||1,range:\"none\"===e.showexponent?e.range.map(e.r2d):[0,t||1]};vt(h),o=(Number(h._tickround)||0)+4,u=h._tickexponent,e.hoverformat&&(c=e.hoverformat)}if(c)return e._numFormat(c)(t).replace(/-/g,P);var p,d=Math.pow(10,-o)/2;if(\"none\"===l&&(u=0),(t=Math.abs(t))
\")):x=h.textLabel;var L={x:h.traceCoordinate[0],y:h.traceCoordinate[1],z:h.traceCoordinate[2],data:w._input,fullData:w,curveNumber:w.index,pointNumber:T};d.appendArrayPointValue(L,w,T),t._module.eventData&&(L=w._module.eventData(L,h,w,{},T));var C={points:[L]};if(e.fullSceneLayout.hovermode){var P=[];d.loneHover({trace:w,x:(.5+.5*m[0]/m[3])*s,y:(.5-.5*m[1]/m[3])*l,xLabel:k.xLabel,yLabel:k.yLabel,zLabel:k.zLabel,text:x,name:c.name,color:d.castHoverOption(w,T,\"bgcolor\")||c.color,borderColor:d.castHoverOption(w,T,\"bordercolor\"),fontFamily:d.castHoverOption(w,T,\"font.family\"),fontSize:d.castHoverOption(w,T,\"font.size\"),fontColor:d.castHoverOption(w,T,\"font.color\"),nameLength:d.castHoverOption(w,T,\"namelength\"),textAlign:d.castHoverOption(w,T,\"align\"),hovertemplate:f.castOption(w,T,\"hovertemplate\"),hovertemplateLabels:f.extendFlat({},L,k),eventData:[L]},{container:n,gd:r,inOut_bbox:P}),L.bbox=P[0]}h.distance<5&&(h.buttons||_)?r.emit(\"plotly_click\",C):r.emit(\"plotly_hover\",C),this.oldEventData=C}else d.loneUnhover(n),this.oldEventData&&r.emit(\"plotly_unhover\",this.oldEventData),this.oldEventData=void 0;e.drawAnnotations(e)},T.recoverContext=function(){var t=this;t.glplot.dispose();var e=function(){t.glplot.gl.isContextLost()?requestAnimationFrame(e):t.initializeGLPlot()?t.plot.apply(t,t.plotArgs):f.error(\"Catastrophic and unrecoverable WebGL error. Context lost.\")};requestAnimationFrame(e)};var A=[\"xaxis\",\"yaxis\",\"zaxis\"];function M(t,e,r){for(var n=t.fullSceneLayout,i=0;i<3;i++){var a=A[i],o=a.charAt(0),s=n[a],l=e[o],u=e[o+\"calendar\"],c=e[\"_\"+o+\"length\"];if(f.isArrayOrTypedArray(l))for(var h,p=0;p<(c||l.length);p++)if(f.isArrayOrTypedArray(l[p]))for(var d=0;d
\");b.text(T).attr(\"data-unformatted\",T).call(f.convertToTspans,t),_=c.bBox(b.node())}b.attr(\"transform\",a(-3,8-_.height)),x.insert(\"rect\",\".static-attribution\").attr({x:-_.width-6,y:-_.height-3,width:_.width+6,height:_.height+3,fill:\"rgba(255, 255, 255, 0.75)\"});var k=1;_.width+6>w&&(k=w/(_.width+6));var A=[n.l+n.w*h.x[1],n.t+n.h*(1-h.y[0])];x.attr(\"transform\",a(A[0],A[1])+o(k))}},e.updateFx=function(t){for(var e=t._fullLayout,r=e._subplots[p],n=0;n
\")}(e,r,n,i):v.getValue(s.text,r),v.coerceString(m,o)}(C,n,i,T,M);w=function(t,e){var r=v.getValue(t.textposition,e);return v.coerceEnumerated(x,r)}(O,i);var z=\"stack\"===g.mode||\"relative\"===g.mode,R=n[i],F=!z||R._outmost;if(D&&\"none\"!==w&&(!R.isBlank&&s!==u&&f!==p||\"auto\"!==w&&\"inside\"!==w)){var B=C.font,N=d.getBarColor(n[i],O),j=d.getInsideTextFont(O,i,B,N),U=d.getOutsideTextFont(O,i,B),V=r.datum();I?\"log\"===T.type&&V.s0<=0&&(s=T.range[0]