Uploaded by 孫利東

hw3

advertisement
Causal Inference (I)
Homework 3
Part I: Estimation for continuous outcome. Show your code and answer by RMarkdown.
A. According to the following models, please simulate a dataset with 1,000 observations by R, and show
the first 5 observations.
𝐿~𝑈𝑛𝑖𝑓𝑜𝑟𝑚(8,16)
𝐴~𝐵𝑒𝑟(𝑝𝑎 ), 𝑝𝑎 = 𝑒𝑥𝑝𝑖𝑡(6 − 0.5𝐿)
𝑌~𝑁(𝐸[𝑌|𝐴 = 𝑎, 𝐿 = 𝑙], 1), 𝐸[𝑌|𝐴 = 𝑎, 𝐿 = 𝑙] = 20 + 2𝐴 + 0.1𝐿
***Before data simulating, fix the Random Number Generation by set.seed(123)
B.
Suppose L represents children’s age, A represents whether a child walks to school (A = 0) or picked up
by parents (A = 1), and 𝑌 represents children’s BMI. Please derive the estimate of causal effect based
on standardization method under difference scale (both point and 95% CI).
C.
D.
Please derive the estimate of causal effect based on regression-based estimator under difference scale
(both point and 95% CI).
Please derive the estimate of causal effect based on IPW estimator under difference scale (both point and
95% CI).
Part II: Estimation for binary outcome. Show your code and answer by RMarkdown.
A. According to the following models, please simulate a dataset with 1,000 observations by R, and show
the first 5 observations.
𝐿~𝐵𝑒𝑟 (𝑝𝑎 ), 𝑝𝑎 = 𝑒𝑥𝑝𝑖𝑡(1)
𝐴~ 𝐵𝑒𝑟 (𝑝𝑎 ), 𝑝𝑎 = 𝑒𝑥𝑝𝑖𝑡(−1 + 3𝐿)
𝑌~ 𝐵𝑒𝑟 (𝑝𝑦 ), 𝑝𝑦 = 𝑒𝑥𝑝𝑖𝑡(−4 − 𝐴 + 3𝐿)
***Before data simulating, fix the Random Number Generation by set.seed(123)
B.
C.
D.
Suppose L represents a subject’s age (L = 0 if age < 65, L = 1 o.w.), A represents whether a subject is in
the control group (A = 0) or the treatment group (A = 1), and 𝑌 represents whether a subject is dead (Y
= 1) or alive (Y = 0). Please derive the estimate of causal effect based on standardization method under
odds ratio scale (both point and 95% CI).
Please derive the estimate of causal effect based on regression-based estimator under odds ratio scale
(both point and 95% CI).
Please derive the estimate of causal effect based on IPW estimator under odds ratio scale (both point and
95% CI).
Download