全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
1658 6
2015-10-25

Age-period-cohort analysis can alternatively be done by the package Epi.

Examples#########################        Belgian lung cancer########        1. Get apc.data.list#        This is ready made.  For other data construct list using apc.data.listdata.list        <- data.Belgian.lung.cancer()objects(data.list)data.list########        2. Plot data#        Plot all data.#        Note a warning is produced because the defaults settings#        lead to an unbalanced grouping of data.apc.plot.data.all(data.list)#        Or make individual plots.#        Plot data sums.apc.plot.data.sums(data.list)#        Plot sparsity to see where data are thin.#        Plots are blank with default settings#        ... therefore change sparsity.limits.apc.plot.data.sparsity(data.list)dev.new()apc.plot.data.sparsity(data.list,sparsity.limits=c(5,10))#        Plot data using different pairs of the three time scales.#        This plot is done for mortality ratios.#        All plots appear to have approximately parallel lines.#        This indicates that interpretation should be done carefully.apc.plot.data.within(data.list,"m",1)########        3. Get a deviance table#        Need to input distribution.#   The table show that the sub-models "AC" and "Ad"#        cannot be rejected relative to the unrestricted "APC" modelapc.fit.table(data.list,"poisson.dose.response")########        4. Estimate selected models#        Consider "APC" and "Ad"#        Consider also the sub-model "A", which is not supported by#        the tests in the deviance tablefit.apc        <- apc.fit.model(data.list,"poisson.dose.response","APC")fit.at        <- apc.fit.model(data.list,"poisson.dose.response","Ad")fit.a        <- apc.fit.model(data.list,"poisson.dose.response","A")#        Get coefficients for canonical parameters throughfit.apc$coefficients.canonicalfit.at$coefficients.canonical########        5. Plot probability transforms of responses given fit#        Black circle are used for central part of distribution.#        Triangles are used in tails, green/blue/red as responses are further in tail#        No sign of mis-specification for "APC" and "Ad": there are many#        black circles and only few coloured triangles.#        In comparison the model "A" yields more extreme observations.#        That model is not supported by the data.  #        To get numerical values see apc.plot.fit.ptapc.plot.fit.pt(fit.apc)apc.plot.fit.pt(fit.at)apc.plot.fit.pt(fit.a)########        6. Plot estimated coefficients #        Consider "APC" and "Ad"#        The first row of plots show double differences of paramters#        The second row of plots shows level and slope determining a linear plane#        The third row shows double sums of double differences,#        all identified to be zero at the begining and at the end.#        Thus the plots in third row must be interpreted jointly with those in the#        second row.  The interpretation of the third row plots#        is that they show deviations from linear trends.  The third row plots are#        not invariant to changes to data arrayapc.plot.fit(fit.apc)dev.new()apc.plot.fit(fit.at)########        7. Recursive analysis#        Cut the first period group and redo analysisdata.list.subset.1 <- apc.data.list.subset(data.list,0,0,1,0,0,0)apc.fit.table(data.list.subset.1,"poisson.dose.response")########        8. Effect of ad hoc identification#        At first a subset is chosen where youngest age and cohort groups#        are truncated.  This way sparsity is eliminated#        and ad hoc identification effects are dominated by estimation#        uncertainty. Then consider#        Plot 1: parameters estimated from data without first age groups#        Plot 2: parameters estimated from all data#        Note that estimates for double difference very similar.#        Estimates for linear slopes are changed because the indices used#        for parametrising these are changed#        Estimates for detrended double sums of age and cohort double differences#        are changed, because they rely on a particular ad hoc identifications#        that have changed.  Nonetheless these plots are useful to evaulate#        variation in time trends over and above linear trends.data.list        <- data.Belgian.lung.cancer()data.list.subset <- apc.data.list.subset(data.list,2,0,0,0,0,0)fit.apc                <- apc.fit.model(data.list,"poisson.dose.response","APC")fit.apc.subset        <- apc.fit.model(data.list.subset,"poisson.dose.response","APC")apc.plot.fit(fit.apc.subset,main.outer="1. Belgian lung cancer: cut first two age groups")dev.new()apc.plot.fit(fit.apc,main.outer="2. Belgian lung cancer data: all data")
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2015-10-25 19:52:30
好乱啊
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2015-10-25 19:53:45
你直接弄个附件上来吧,这怎么读啊
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2015-10-25 20:55:17
刺客王朝 发表于 2015-10-25 19:52
好乱啊
不好意思,在R界面 打  ?apc  就出来了
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2015-10-25 20:55:55
richardgu26 发表于 2015-10-25 19:53
你直接弄个附件上来吧,这怎么读啊
不好意思,在R 的界面 打 ?apc  出来的  因为我想用apc这个包
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2015-10-25 20:57:03
Identification.pdf
大小:(189.19 KB)

 马上下载

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群