r - Error: term has fewer unique covariate combinations than specified maximum degrees of freedom -
i'm trying smooth mortality data, error when try call smooth.demogdata(...). don't have lot of years work (just 2004-2014), , ages 1-11. need have smoothed mortality data able run lee-carter models.
> us.demog.age = demogdata(us_rates.age, us_counts.age, ages = 1:11, years = 2004:2014, type="mortality", name="total", label="us") > smooth.age = smooth.demogdata(us.demog.age) error in smooth.construct.tp.smooth.spec(object, dk$data, dk$knots) : term has fewer unique covariate combinations specified maximum degrees of freedom
the matrix data have demography data call follows:
> us_counts.age 135618, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 150988, 125213, 0, 0, 0, 0, 0, 0, 0, 0, 0 144797, 144686, 117643, 0, 0, 0, 0, 0, 0, 0, 0 145921, 138953, 136791, 110374, 0, 0, 0, 0, 0, 0, 0 146350, 139452, 131145, 128469, 103897, 0, 0, 0, 0, 0, 0 159301, 139080, 130705, 122500, 120655, 97922, 0, 0, 0, 0, 0 169750, 151355, 130195, 121681, 114789, 113711, 92623, 0, 0, 0, 0 166925, 158914, 142749, 122450, 114941, 108932, 108085, 88116, 0, 0, 0 174177, 158635, 150225, 134504, 116111, 109365, 103898, 103520, 84283, 0, 0 174938, 165078, 149825, 141967, 127656, 110712, 104557, 99706, 99568, 80944, 0 169517, 165777, 155530, 141601, 134922, 121745, 105924, 100205, 95836, 95749, 77716 > us_rates.age 0.0034287484, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 0.0031989297, 0.0036178352, 0, 0, 0, 0, 0, 0, 0, 0, 0 0.0029213312, 0.0032415023, 0.0036636264, 0, 0, 0, 0, 0, 0, 0, 0 0.0022957628, 0.0028930646, 0.0031873442, 0.0035334408, 0, 0, 0, 0, 0, 0, 0 0.0017902289, 0.0023162092, 0.0027298029, 0.0030513198, 0.0033013465, 0, 0, 0, 0, 0, 0 0.0015254142, 0.0017328156, 0.0022187369, 0.0025224490, 0.0028925449, 0.0029717530, 0, 0, 0, 0, 0 0.0011310751, 0.0014733573, 0.0016052844, 0.0020052432, 0.0023434301, 0.0025855018, 0.0027207065, 0, 0, 0, 0 0.0008926164, 0.0011389808, 0.0013730394, 0.0014373214, 0.0018531246, 0.0021389491, 0.0022297266, 0.0024286168, 0, 0, 0 0.0004994919, 0.0008068837, 0.0009452488, 0.0011300779, 0.0012057428, 0.0015818589, 0.0017805925, 0.0019513138, 0.0020882028, 0, 0 0.0003029645, 0.0004422152, 0.0006407475, 0.0007466524, 0.0007676882, 0.0008761471, 0.0012815976, 0.0014442461, 0.0014362044, 0.0016184028, 0 0.0001415787, 0.0002050948, 0.0002829036, 0.0003954774, 0.0003705845, 0.0004517639, 0.0004342736, 0.0006885884, 0.0008138904, 0.0008772938, 0.0009264502
the data tracking cohorts on time, why there zeroes in upper right half of both matrices, since no previous information on cohorts available, listed 0s, 0s , actual available data need smoothed.
is there way can smooth.demogdata function work? know saw changing default knot values 10 lower, wasn't able find again.
Comments
Post a Comment