Health and Retirement Study (HRS)
收藏资源简介:
analyze the health and retirement study (hrs) with r the hrs is the one and only longitudinal survey of american seniors. with a panel starting its third decade, the current pool of respondents includes older folks who have been interviewed every two years as far back as 1992. unlike cross-sectional or shorter panel surveys, respondents keep responding until, well, death d o us part. paid for by the national institute on aging and administered by the university of michigan's institute for social research, if you apply for an interviewer job with them, i hope you like werther's original. figuring out how to analyze this data set might trigger your fight-or-flight synapses if you just start clicking arou nd on michigan's website. instead, read pages numbered 10-17 (pdf pages 12-19) of this introduction pdf and don't touch the data until you understand figure a-3 on that last page. if you start enjoying yourself, here's the whole book. after that, it's time to register for access to the (free) data. keep your username and password handy, you'll need it for the top of the download automation r script. next, look at this data flowchart to get an idea of why the data download page is such a righteous jungle. but wait, good news: umich recently farmed out its data management to the rand corporation, who promptly constructed a giant consolidated file with one record per respondent across the whole panel. oh so beautiful. the rand hrs files make much of the older data and syntax examples obsolete, so when you come across stuff like instructions on how to merge years, you can happily ignore them - rand has done it for you. the health and retirement study only includes noninstitutionalized adults when new respondents get added to the panel (as they were in 1992, 1993, 1998, 2004, and 2010) but once they're in, they're in - respondents have a weight of zero for interview waves when they were nursing home residents; but they're still responding and will continue to contribute to your statistics so long as you're generalizing about a population from a previous wave (for example: it's possible to compute "among all americans who were 50+ years old in 1998, x% lived in nursing homes by 2010"). my source for that 411? page 13 of the design doc. wicked. this new github repository contains five scripts: 1992 - 2010 download HRS microdata.R loop through every year and every file, download, then unzip everything in one big party impor t longitudinal RAND contributed files.R create a SQLite database (.db) on the local disk load the rand, rand-cams, and both rand-family files into the database (.db) in chunks (to prevent overloading ram) longitudinal RAND - analysis examples.R connect to the sql database created by the 'import longitudinal RAND contributed files' program create tw o database-backed complex sample survey object, using a taylor-series linearization design perform a mountain of analysis examples with wave weights from two different points in the panel import example HRS file.R load a fixed-width file using only the sas importation script directly into ram with < a href="http://blog.revolutionanalytics.com/2012/07/importing-public-data-with-sas-instructions-into-r.html">SAScii parse through the IF block at the bottom of the sas importation script, blank out a number of variables save the file as an R data file (.rda) for fast loading later replicate 2002 regression.R connect to the sql database created by the 'import longitudinal RAND contributed files' program create a database-backed complex sample survey object, using a taylor-series linearization design exactly match the final regression shown in this document provided by analysts at RAND as an update of the regression on pdf page B76 of this document . click here to view these five scripts for more detail about the health and retirement study (hrs), visit: michigan's hrs homepage rand's hrs homepage the hrs wikipedia page a running list of publications using hrs notes: exemplary work making it this far. as a reward, here's the detailed codebook for the main rand hrs file. note that rand also creates 'flat files' for every survey wave, but really, most every analysis you c an think of is possible using just the four files imported with the rand importation script above. if you must work with the non-rand files, there's an example of how to import a single hrs (umich-created) file, but if you wish to import more than one, you'll have to write some for loops yourself. confidential to sas, spss, stata, and sudaan users: a tidal wave is coming. you can get water up your nose and be dragged out to sea, or you can grab a surf board. time to transition to r. :D
本教程将介绍如何使用R语言(R)分析健康与退休研究(Health and Retirement Study, HRS)数据集。HRS是针对美国老年群体的唯一一项纵向追踪调查,该追踪调查始于三十年前(当前已进入第三个十年),目前的受访对象群体涵盖了自1992年起每两年接受一次访谈的老年受访者。与横断调查或短期追踪调查不同,受访者将持续参与调查直至离世。该调查由美国国家老龄化研究所(National Institute on Aging, NIA)资助,密歇根大学社会研究所(Institute for Social Research, ISR)负责执行。若你申请该机构的访员职位,想必会对威特经典(Werther's Original)糖果情有独钟(注:此处为玩笑式调侃,暗示访员工作耗时较长)。 若直接在密歇根大学的官网摸索该数据集的分析方法,你大概率会感到手足无措。建议先阅读该介绍PDF的第10-17页(对应PDF页码12-19),务必先理解最后一页的图A-3后再着手处理数据。若你渐入佳境,可进一步查阅完整手册。完成学习后,即可注册获取免费的数据集。请妥善保管你的账号与密码,后续编写下载自动化R脚本时需用到。 接下来可查看该数据流程图,了解为何密歇根大学官网的数据下载页面宛如复杂的迷宫。不过好消息是:密歇根大学近期已将数据管理工作外包给兰德公司(Rand Corporation),后者迅速搭建了一份整合度极高的数据集,为每位追踪受访者生成一条单独的记录,可谓十分便捷。兰德公司的HRS数据集已淘汰了大量旧版数据与语法示例,因此若遇到诸如"如何合并不同年份数据"的教程,可直接忽略——兰德公司已完成了该整合工作。 健康与退休研究在新增追踪受访者时(如1992、1993、1998、2004及2010年的新增样本)仅纳入非机构化居住的成年人,但一旦纳入样本库,其数据将持续保留。若受访者在某一轮调查时入住养老院,其在该轮的权重设为0;但他们仍会被计入后续调查,且当你基于过往调查队列进行群体推断时,其数据依然有效。例如可计算"1998年年龄≥50岁的美国人群中,至2010年有X%入住养老院"的指标。本段信息的来源为设计文档第13页,十分实用。 本GitHub仓库包含5个R脚本: 1. `1992-2010 download HRS microdata.R`:遍历所有年份与文件,下载并解压全部数据。 2. `import longitudinal RAND contributed files.R`:在本地磁盘创建SQLite数据库(.db文件),分批次导入兰德公司提供的纵向数据、兰德-CAMS数据及两类兰德家庭数据,避免内存过载。 3. `longitudinal RAND - analysis examples.R`:连接由`import longitudinal RAND contributed files`脚本创建的SQLite数据库,采用泰勒级数线性化设计创建基于数据库的复杂抽样调查对象,基于追踪调查两轮的权重开展大量分析示例。 4. `import example HRS file.R`:通过SAScii工具(参考http://blog.revolutionanalytics.com/2012/07/importing-public-data-with-sas-instructions-into-r.html)直接将固定宽度格式文件加载至内存,解析SAS导入脚本底部的IF语句块,清空部分变量后,将文件保存为可快速加载的R数据文件(.rda)。 5. `replicate 2002 regression.R`:连接由`import longitudinal RAND contributed files`脚本创建的SQLite数据库,采用泰勒级数线性化设计创建基于数据库的复杂抽样调查对象,复现兰德公司分析师提供的本文件B76页回归分析示例。 若需查看这5个脚本的详细说明,或了解更多健康与退休研究的相关信息,可访问以下链接: - 密歇根大学HRS官网 - 兰德公司HRS官网 - HRS维基百科页面 - 基于HRS的已发表文献汇总清单 小贴士:能坚持至此的你已完成了出色的前期工作,作为奖励,此处提供兰德公司主HRS数据集的详细代码本。需注意,兰德公司还为每一轮调查生成了"扁平文件",但实际上绝大多数分析仅需使用上述兰德导入脚本导入的4个文件即可完成。若你必须使用非兰德公司的原始数据,可参考单份HRS(密歇根大学制作)文件的导入示例;若需批量导入多份文件,则需自行编写循环脚本。 致SAS、SPSS、Stata及SUDAAN用户:一场数据浪潮即将来袭,你要么被呛水拖入深海,要么拿起冲浪板顺势而为——是时候转向R语言了!:D




