Curve fitting Session 2
Method background • Disability rates are strongly linked to age • However HSE disability rates for single years of age are u...
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
Dealing with sampling variability Mobility disability schedule .6
HSE 2000/01
Proportion
.4
Rates are unreliable particularly where sample sizes are small
0
.2
Smooth fluctuations by fitting a curve
0
20
40
60 Age
80
Dealing with sampling variability
0
.2
Weight
.4
.6
Mobility schedules - observed and modelled
0
20
40
60
80
Age Observed survey rates Source: Health Survey for England 2000/01
Modelled rates
What function?
• Lots of choices • Quadratic (y=b0+b1x+b2x3+b3x3 • Exponential functions • Estimation of mortality schedules • Statistics Canada use an exponential curve to model disability schedules in Canadian territories
Exponential curve
D( x) = e
a + bx
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)
Mobility disability schedules – observed and modelled
0
.2
Weight
.4
.6
Mobility proportions - observed and modelled
0
20
40
60
80
Age Observed survey rates Source: Health Survey for England 2000/01
Modelled rates
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:
Nx wx ( p) = p x (1 − p x )
Where px = proportion with a disability at age x and Nx 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)
Nx wx ( p ) = p x (1 − p x ) egen mobilitycount=count(MO_OBS_RT), by (age sex) gen mobilityweight=mobilitycount/(MO_OBS_RT*(1*MO_OBS_RT))
Mobility schedules – observed and modelled (with weights)
Weight
.4
.6
Mobility schedules - observed and modelled
0
.2
Better fit at youngest ages
0
20
40
60
80
Age Observed survey rates Source: Health Survey for England 2000/01
Modelled rates
Task 4 – regional curves
• Open HSE data • Drop institutional residents (no gora) • Are differences in regional rates of mobility disability significant? (1.4.2-1.4.3) •
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 Fit curves for each region (males and females) 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
Regional mobility disability schedules
0
.2
Proportion .4
.6
.8
Males
0
20
40
60 Age
North East Source: Health Survey for England
South East
80
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