Curve fitting Session 2
Method background Disability rates are strongly linked to age However HSE disability rates for single years of age are unstable We can fit a curve to the disability schedule to smooth the fluctuations Model rates (national or regional)*local population totals
Source: HSE 2001 Mobility disability – England (Males)
Personal care disability – England (males) Source: HSE 2001
Dealing with sampling variability Rates are unreliable particularly where sample sizes are small Smooth fluctuations by fitting a curve
Dealing with sampling variability
What function? Lots of choices Quadratic (y=b 0 +b 1 x+b 2 x 3 +b 3 x 3 Exponential functions Estimation of mortality schedules Statistics Canada use an exponential curve to model disability schedules in Canadian territories
Exponential curve Where: D(x)= the proportion of people with a disability at age x
Practical structure Task 3 – Fit an exponential curve to (England) mobility schedules (with and without weights). Uses saved data from task 2 Task 4 – Fit curves to regional mobility schedules Task 5 – Use your model rates to calculate the number of people with a mobility disability in six districts. (Data provided)
Fitting a curve in stata nl (MO_OBS_RT=exp({a}+{b}*age)) predict pred_MO_UK
Exponential curve – parameter estimates (males) Confidence interval a b
Mobility disability schedules – observed and modelled
Analytic weights Stata treats the rates at each age as being equally reliable. Can use weights to relax this assumption If we assume our rates stem from a binomial process then: Where p x = proportion with a disability at age x and N x equals the number of people sampled at age x.
Calculating weights (task 3) Re-open the HSE data Re-calculate age specific rates (MO_OBS_RT) (as in task 2) egen mobilitycount=count(MO_OBS_RT), by (age sex) gen mobilityweight=mobilitycount/(MO_OBS_RT*(1*MO_OBS_RT))
Model weights – mobility disability
Fitting a curve in stata nl (MO_OBS_RT=exp({a}+{b}*age)) [aweight=mobilityweight] predict pred_MO_UK
Mobility schedules – observed and modelled (with weights) Better fit at youngest ages
Task 4 – regional curves Open HSE data Drop institutional residents (no gora) Are differences in regional rates of mobility disability significant? ( )
Task 4 - regional curves Calculate regional schedules of mobility disability rates by sex age gora: egen MO_num=total(mobility_w) by sex age gora: egen MO_denom=total(count_w) gen MO_OBS_RT=MO_num/MO_denom
Task 4 – regional curves Weights are the same as used for national data (task 3) Regional age patterns of weight very unstable After calculating regional rates and weights: Duplicates drop age sex gora, force
Task 4 –regional curves nl (MO_OBS_RT=exp({a}+{b}*age)) if sex==1&gora==1 [aweight=mobilityweight] predict pred_MO1_M nl (MO_OBS_RT=exp({a}+{b}*age)) if sex==1&gora==2 [aweight=mobilityweight] predict pred_MO2_M Fit curves for each region (males and females)
Task 5 Aim - generate district estimates of the numbers of people with mobility disabilities Practical 1 task 5 dataset.dta a row for each single year of age (10, 11,….84,88) for males and females in each of the six districts Contains the national and regional model rates from tasks 3 and 4 Population counts