Post on 28-Mar-2015
transcript
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
0.2
.4.6
Pre
vale
nce
rat
e
10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90Age
Source: HSE 2001
Mobility disability – England (Males)
Personal care disability – England (males)
0.1
.2.3
Pre
vale
nce
rate
10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90Age
Source: HSE 2001
Dealing with sampling variability0
.2.4
.6P
rop
ortio
n
0 20 40 60 80Age
HSE 2000/01Mobility disability schedule
Rates are unreliable particularly where sample sizes are small
Smooth fluctuations by fitting a curve
Dealing with sampling variability
0.2
.4.6
We
ight
0 20 40 60 80Age
Observed survey rates Modelled rates
Source: Health Survey for England 2000/01
Mobility schedules - observed and modelled
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
bxaexD )(
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
bxaexD )(
Exponential curve – parameter estimates (males)
Confidence interval
a -4.4 -4.79 -4.09
b 0.04 0.04 0.05
Mobility disability schedules – observed and modelled
0.2
.4.6
We
ight
0 20 40 60 80Age
Observed survey rates Modelled rates
Source: Health Survey for England 2000/01
Mobility proportions - 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 px = proportion with a disability at age x and Nx equals the number of people sampled at age x.
)1()(
xx
xx pp
Npw
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))
)1()(
xx
xx pp
Npw
Model weights – mobility disability
010
000
2000
030
000
We
ight
0 20 40 60 80Age
Source: Health Survey for England 2000/01
Weights associated with locomotor proportions
Fitting a curve in stata
nl (MO_OBS_RT=exp({a}+{b}*age)) [aweight=mobilityweight]
predict pred_MO_UK
bxaexD )(
Mobility schedules – observed and modelled (with weights)
0.2
.4.6
We
ight
0 20 40 60 80Age
Observed survey rates Modelled rates
Source: Health Survey for England 2000/01
Mobility schedules - observed and modelled
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? (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
nl (MO_OBS_RT=exp({a}+{b}*age)) ifsex==1&gora==1 [aweight=mobilityweight]
predict pred_MO1_M
nl (MO_OBS_RT=exp({a}+{b}*age)) ifsex==1&gora==2 [aweight=mobilityweight]
predict pred_MO2_M
Fit curves for each region (males and females)
0.2
.4.6
.8P
ropo
rtio
n
0 20 40 60 80Age
North East South East
Source: Health Survey for England
MalesRegional mobility disability schedules
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