1 / 29

孟德尔随机化在流行病学中的应用.ppt

SLC2A9

SLC2A9与暴露关系
SLC2A9与尿酸有很强的线性相关
SLC2A9与混杂的关系
SLC2A9与暴露及结局的关系

r package instrumental variables google AER

A data frame containing 48 observations on 7 variables for 2 periods.
state Factor indicating state.
year Factor indicating year.
cpi Consumer price index.
population State population.
packs Number of packs per capita.
income State personal income total, nominal .
tax Average state, federal and average local excise taxes for fiscal year.
price Average price during fiscal year, including sales tax.
taxs Average excise taxes for fiscal year, including sales tax.

CigarettesSW\$rprice <- with CigarettesSW, price/cpi
CigarettesSW\$rincome <- with CigarettesSW, income/population/cpi
CigarettesSW\$tdiff <- with CigarettesSW, taxs - tax /cpi
c1985 <- subset CigarettesSW, year == "1985"
c1995 <- subset CigarettesSW, year == "1995"

## data
data "CigarettesSW"
CigarettesSW\$rprice <- with CigarettesSW, price/cpi
CigarettesSW\$rincome <- with CigarettesSW, income/population/cpi
CigarettesSW\$tdiff <- with CigarettesSW, taxs - tax /cpi
## model
fm <- ivreg log packs ~ log rprice + log rincome | log rincome + tdiff + I tax/cpi ,
data = CigarettesSW, subset = year == "1995"
summary fm

Details

Regressors and instruments for ivreg are most easily specified in a formula with two parts on the right-hand side, e.g., y ~ x1 + x2 | z1 + z2 + z3, where x1 and x2 are the regressors and z1, z2, and z3 are the instruments. Note that exogenous regressors have to be included as instruments for themselves