Wednesday, 15 January 2014

How do I calculate age specific R^2 in R -


I have got demographic dataset of Swedish death rate at death rate which is between 1751 and 2011 and ages 0 to 110 years. I have used the {demography} package to fit Li-Carter model for the duration of the period 1900 to 2011 and for the period 0 to 100. Now I need to fit my estimations and to do this, use the determination coefficient. My problem is now, I need age from 0 to 100 for specific R ^ 2 to age and only when the model is assessed, only the overall R ^ 2 is given. In other words, I need to find R ^ 2 through the formula

R ^ 2 (x) = 1 - Σ_x (m (x, t) - estimated {m (x, t)} ) ^ 2 / Σ_x (m (x, t) - mean {m (x)}) ^ 2

for every x = 0, ..., 100 here (x, t) of The prediction M (x, t) and mean {m (x)} predicting death rate is one year of age and the age of one year is estimated to be my age This way is far:

  # Li-Carter Wish of Swedish Mortality Analysis data # Mortality Analysis Data Used in Death Rate Analysis Library (Demographics) Library (Forecasting) Library (Life Content): Sweden and lieutenant; -MMDMX (country = "SWE", user name = "username@email.domin", password = "password", label = "Sweden") # Benefits of the LC model (in logarithm) SWE.lcaM & lt; - Lca (Sweden, series = "male", max.age = 100, year = 19 00: 2011, Interpolate = True) SWE.lcaF < - lca (Sweden, series = "feminine", max.age = 100, years = 1900: 2011, interpolate = TRUE) # R ^ 2 (x) capacitance. Fit values ​​are in logarithm, so they should be replaced by XP ().  

I do not know how to move from here.


No comments:

Post a Comment