The parametric g- formula in SAS JESSICA G. YOUNG CIMPOD 2017 CASE STUDY 1

Similar documents
Incumbency as a Source of Spillover Effects in Mixed Electoral Systems: Evidence from a Regression-Discontinuity Design.

Introduction to Path Analysis: Multivariate Regression

Supplemental Online Appendix to The Incumbency Curse: Weak Parties, Term Limits, and Unfulfilled Accountability

SIMPLE LINEAR REGRESSION OF CPS DATA

Split Decisions: Household Finance when a Policy Discontinuity allocates Overseas Work

Autocratic Transitions and Growth. Tommaso Nannicini, Bocconi University and IZA Roberto Ricciuti, Università di Verona e CESifo

DOES MIGRATION DISRUPT FERTILITY? A TEST USING THE MALAYSIAN FAMILY LIFE SURVEY

Lab 3: Logistic regression models

Table A.2 reports the complete set of estimates of equation (1). We distinguish between personal

Supporting Information Political Quid Pro Quo Agreements: An Experimental Study

Effects of Unionization on Workplace-Safety Enforcement: Regression-Discontinuity Evidence

Neveen Shafeek Amin 1 DO NOT CIRCULATE OR QUOTE WITHOUT PERMISSION FROM THE AUTHOR

Determinants of Return Migration to Mexico Among Mexicans in the United States

Powersharing, Protection, and Peace. Scott Gates, Benjamin A. T. Graham, Yonatan Lupu Håvard Strand, Kaare W. Strøm. September 17, 2015

The Effectiveness of Receipt-Based Attacks on ThreeBallot

Cluster Analysis. (see also: Segmentation)

Front-door Difference-in-Differences Estimators *

Do Parties Matter for Fiscal Policy Choices? A Regression-Discontinuity Approach

Differences in remittances from US and Spanish migrants in Colombia. Abstract

Modelling migration: Review and assessment

Hoboken Public Schools. AP Statistics Curriculum

On the Causes and Consequences of Ballot Order Effects

Can Politicians Police Themselves? Natural Experimental Evidence from Brazil s Audit Courts Supplementary Appendix

Classifier Evaluation and Selection. Review and Overview of Methods

Supplementary/Online Appendix for:

Experiments in Election Reform: Voter Perceptions of Campaigns Under Preferential and Plurality Voting

Mapping Policy Preferences with Uncertainty: Measuring and Correcting Error in Comparative Manifesto Project Estimates *

Random Forests. Gradient Boosting. and. Bagging and Boosting

Congressional Careers, Committee Assignments, and Seniority Randomization in the US House of Representatives

Overview. Ø Neural Networks are considered black-box models Ø They are complex and do not provide much insight into variable relationships

JudgeIt II: A Program for Evaluating Electoral Systems and Redistricting Plans 1

1. The Relationship Between Party Control, Latino CVAP and the Passage of Bills Benefitting Immigrants

Explaining the Deteriorating Entry Earnings of Canada s Immigrant Cohorts:

have been prohibitively expensive as well.

Factors influencing Latino immigrant householder s participation in social networks in rural areas of the Midwest

Hierarchical Item Response Models for Analyzing Public Opinion

The Impact of Unionization on the Wage of Hispanic Workers. Cinzia Rienzo and Carlos Vargas-Silva * This Version, December 2014.

Working Paper No. 266

Research Statement. Jeffrey J. Harden. 2 Dissertation Research: The Dimensions of Representation

Gender preference and age at arrival among Asian immigrant women to the US

Chapter. Estimating the Value of a Parameter Using Confidence Intervals Pearson Prentice Hall. All rights reserved

Hoboken Public Schools. Algebra II Honors Curriculum

Incumbency Advantages in the Canadian Parliament

MEN in several minority groups in the United States

Household Vulnerability and Population Mobility in Southwestern Ethiopia

Supplementary Materials A: Figures for All 7 Surveys Figure S1-A: Distribution of Predicted Probabilities of Voting in Primary Elections

Statistics, Politics, and Policy

Female political leaders, the view of the world. <English translation of the title, maximum two lines incl. subtitle>

Food Insecurity among Latin American Recent Immigrants in Toronto. Dr. Mandana Vahabi. Dr. Cecilia Rocha. Daphne Cockwell School of Nursing

GAME THEORY. Analysis of Conflict ROGER B. MYERSON. HARVARD UNIVERSITY PRESS Cambridge, Massachusetts London, England

Supplementary Materials for Strategic Abstention in Proportional Representation Systems (Evidence from Multiple Countries)

Immigrant Employment and Earnings Growth in Canada and the U.S.: Evidence from Longitudinal data

American Law & Economics Association Annual Meetings

Schooling and Cohort Size: Evidence from Vietnam, Thailand, Iran and Cambodia. Evangelos M. Falaris University of Delaware. and

PROJECTING THE LABOUR SUPPLY TO 2024

A Dead Heat and the Electoral College

DU PhD in Home Science

The Impact of Unionization on the Wage of Hispanic Workers. Cinzia Rienzo and Carlos Vargas-Silva * This Version, May 2015.

The Size of Local Legislatures and Women s Political Representation: Evidence from Brazil

Support Vector Machines

Brain drain and Human Capital Formation in Developing Countries. Are there Really Winners?

Maps and Hash Tables. EECS 2011 Prof. J. Elder - 1 -

GOVERNANCE RETURNS TO EDUCATION: DO EXPECTED YEARS OF SCHOOLING PREDICT QUALITY OF GOVERNANCE?

Europeans support a proportional allocation of asylum seekers

Red flags of institutionalised grand corruption in EU-regulated Polish public procurement 2

Online Appendix for Redistricting and the Causal Impact of Race on Voter Turnout

Practice Questions for Exam #2

Poverty Reduction and Economic Growth: The Asian Experience Peter Warr

Heterogeneity in the Association between Acculturation and Adiposity among Immigrants to the United States. Sandra S. Albrecht

Processes. Criteria for Comparing Scheduling Algorithms

Wisconsin Economic Scorecard

Revisiting the Effect of Food Aid on Conflict: A Methodological Caution

Preliminary Effects of Oversampling on the National Crime Victimization Survey

Far Right Parties and the Educational Performance of Children *

IV. Labour Market Institutions and Wage Inequality

List of Tables and Appendices

Online Supplement to Female Participation and Civil War Relapse

Attrition in the National Longitudinal Survey of Youth 1997

What makes people feel free: Subjective freedom in comparative perspective Progress Report

Introduction to data on ethnicity

GEORG-AUGUST-UNIVERSITÄT GÖTTINGEN

Maps, Hash Tables and Dictionaries

NBER WORKING PAPER SERIES HEALTH AND HEALTH INSURANCE TRAJECTORIES OF MEXICANS IN THE US. Neeraj Kaushal Robert Kaestner

Genetic Algorithms with Elitism-Based Immigrants for Changing Optimization Problems

November 15-18, 2013 Open Government Survey

Case Study: Get out the Vote

STATISTICAL GRAPHICS FOR VISUALIZING DATA

Exploring the Impact of Democratic Capital on Prosperity

Rural-urban Migration and Urbanization in Gansu Province, China: Evidence from Time-series Analysis

Political text is a fundamental source of information

Voting Rights and Immigrant Incorporation: Evidence from Norway

Probabilistic earthquake early warning in complex earth models using prior sampling

Forecasting the 2018 Midterm Election using National Polls and District Information

IS THE MEASURED BLACK-WHITE WAGE GAP AMONG WOMEN TOO SMALL? Derek Neal University of Wisconsin Presented Nov 6, 2000 PRELIMINARY

Combining national and constituency polling for forecasting

Are Politicians Office or Policy Motivated? The Case of U.S. Governors' Environmental Policies

Political Parties and the Tax Level in the American states: Two Regression Discontinuity Designs

Investigating the dynamics of migration and health in Australia: A Longitudinal study

Extended Families across Mexico and the United States. Extended Abstract PAA 2013

Corruption and business procedures: an empirical investigation

Transcription:

The parametric g- formula in SAS JESSICA G. YOUNG CIMPOD 2017 CASE STUDY 1

Structure of the workshop Part I: Motivation Ø Why we might use the parametric g- formula and how it works in general Part II: GFORMULA SAS macro Ø Structure of the macro Ø Sample code

GFORMULA macro Contributors: Miguel Hernán, Sarah Taubman, Roger Logan, Jessica Young, Sara Lodi, Sally Picciotto, GoodarzDanaei Version on web: 2.0 Version for today: 3.0

Contact info Updates to macro and documentation: https://www.hsph.harvard.edu/causal/software/ My email: jessica.gerald.young@gmail.com

PART I: MOTIVATION

Case study Lajous et al. Changes in fish consumption in Midlife and the Risk of Coronary Heart Disease in Men and Women. American Journal of Epidemiology (2013). Interested in estimating the causal effect of different time- varying (sustained) fish consumption interventions on 18 year risk of coronary heart disease (CHD) in a study population.

Causal effect Population causal effects can be formally defined in terms of contrasts in counterfactual outcome distributions associated with different intervention rules: Ø What would happen to the population 18 year risk of CHD if, possibly contrary to fact, we intervened on fish consumption at each time over the 18 year follow- up period in one way versus another?

Lajous et al: Causal 18 year risk ratio/difference comparing : 1. Always eat at least 3 servings of fish per week versus 2. Natural Course : no intervention on fish

Ideal RCT If we could, we would estimate such an effect in an ideal randomized controlled trial: Ø Baseline randomization: subjects randomized to one of two treatment arms (at least 3 servings or do nothing) Ø Full compliance with protocol until CHD event or 18 years later (whichever comes first) Ø Eliminate censoring events (e.g. study drop out, incomplete follow- up)

Ideal RCT Ø No confounding (by design) Ø No selection bias (by design) Ø Unbiased estimate of risk difference: difference in proportions of CHD in each arm

Challenge to causal inference Ideal RCTs are often not feasible v Too costly v Not timely v Unethical Alternative: Observational studies

Observational data No RCT had been conducted to answer the question of Lajous et al. They used observational data to try and estimate their causal effect of interest: Ø Health Professionals Follow- up Study Ø Nurses Health Study

Nurses Health Study Ø Prospective cohort study, enrolled 121,701 US female registered nurses aged 30-55 years in 1976. Ø Participants reported via questionnaire information on health behaviors and newly diagnosed diseases every two years. Ø Lajous et al. defined baseline as 1990 questionnaire Ø Eligibility for inclusion: free of CVD, diabetes or cancer prior to 1986 Ø Sample of N= 53,772 women at baseline Ø Censored subjects at first time failed to return questionnaire

Confounding and assumptions Ø In Nurses Health Study there is confounding (no exposure randomization at any time, no forcing ) Ø People who eat more fish at a given time may have past characteristics that make them more or less at risk for CHD Ø Some subjects are also censored by incomplete follow- up (failure to return questionnaire) Ø Some subjects also die of non- CHD causes

Confounding and assumptions If we are willing to assume no unmeasured confounding or selection bias (NUCS) we can get an unbiased estimate Ø NUCS: Measured variables are sufficient to control confounding and selection by unmeasured risk factors Ø NUCS is an untestable assumption cannot test with study variables

No unmeasured confounding Key features of NUCS: 1. Allows presence of measured time- varying confounders (in addition to baseline confounding) Ø E.g. BMI measured in questionnaire interval k predicts future CHD and future fish intake. 2. Also allows that measured time- varying confounders are themselves affected by past exposure Ø E.g. BMI at k affected by Fish at k- 1

CAUSAL DAG REPRESENTING NO UNMEASURED CONFOUNDING Unmeasured genetic factor BMI time k- 1 Fish k- 1 BMI time k Fish k CHD k+1 Measured past Absence of arrows from unmeasured risk factor into exposure guarantees no unblocked backdoor paths between exposure and outcome given measured past at any time. Backdoor paths = confounded paths; Directed paths = causal paths

BMI MEASURED TIME- VARYING CONFOUNDER AFFECTED BY EXPOSURE Unmeasured genetic factor BMI time k- 1 Fish k- 1 BMI time k Fish k CHD 18 years Measured past ALLOWS THAT MEASURED TIME- VARYING CONFOUNDER AFFECTED BY PAST EXPOSURE ( NO UNMEASURED CONFOUNDING ALLOWS THIS STRUCTURE)

Time- varying confounding and standard regression Turns out that even though, under this data structure, we can get an unbiased estimate, Ø We cannot get it via standard regression approaches Ø We need other approaches Ø Why?

Standard outcome regression Lajous et al.: might think to fit regression model for CHD hazard at a given time with independent variables: Ø Function of time- varying exposure cumulative average fish consumption through prior time k Ø Function of baseline and time- varying confounders - - cumulative average of BMI through k Use coefficient on cumulative average fish consumption as estimate of time- varying causal exposure effect

Standard outcome regression Problem: even given no unmeasured confounding and outcome regression model correctly specified Ø Coefficient is a biased estimate under our DAG

BMI MEASURED TIME- VARYING CONFOUNDER AFFECTED BY EXPOSURE Unmeasured genetic factor BMI time k- 1 Fish k- 1 BMI time k Fish k CHD k+1 Measured past INCLUDING FUNCTION OF BMI AT k IN REGRESSION MODEL IS CONDITIONING ON IT CONDITIONING ON COLLIDER OPENS UP NONCAUSAL PATH BETWEEN ITS CAUSES

Estimation in observational data with time- varying confounding If not, standard regression, then how to proceed? In this setting, methods that derive from Robins g- formula can remain valid: Ø They give unbiased estimates of time- varying causal exposure effects in the face of measured time- varying confounding affected by past exposure.

The g- formula Robins (1986) showed that, given NUCS Ø The counterfactual outcome mean/risk associated with a user- specified time- varying exposure intervention g can be written as the g- formula indexed by intervention g Ø The g- formula indexed by g is a particular function of the baseline and time- varying data Ø Estimated contrasts in this function for different choices of g can give unbiased estimates of causal effects Ø Also requires positivity assumption

G- formula for Risk by end of follow- up under intervention g Can write as weighted average of conditional risks Ø Each risk conditioned on a possible treatment and confounder history observable under g and no censoring Ø Weights are function of joint distribution of measured confounders at each time k conditional on past history observable under g and no censoring Ø i.e. the chance of observing each confounder history (under g) and no censoring

G- formula for Risk by end of follow- up under intervention g Weights can also be a function of the observed distribution exposure at each time conditional on past history observable under g and no censoring Ø This will be the case when g is defined in terms of intervention that depends on this distribution Ø E.g. intervention is: assign fish according to random draw from observed distribution of fish in Nurses Health Study

How to estimate this function In typical high- dimensional settings, we require parametric models to estimate the g- formula. Different methods rely on different types of model assumptions Ø Parametric g- formula: imposes models directly on components of weighted average Ø Other methods derive from alternative representations of this weighted average which suggest constraining different quantities (e.g. IPW of MSMs, DR methods like TMLE) Ø Equivalent under saturated models

Parametric g- formula Algorithm (Step 1) First fits parametric models for Ø Discrete hazard at each time conditional on past measured treatment and confounders Ø Joint distribution of treatment and confounders at each time given past Ø Models are generally pooled over time

Modelling joint distribution of covariates at k Model based on arbitrary factorization of covariates at k. E.g. f(bmi k,fish k past through k- 1) is the same as 1. f(bmi k fish k,past through k- 1)*f(fish k past through k- 1) or 2. f(fish k bmi k,past through k- 1)*f(bmi k past through k- 1) Depending on choice of factorization, you are modelling the components of product 1 or product 2 Ø In absence of model misspecification, equivalent. Ø Deterministic relationships may favor one factorization

Algorithm: Step 2 N times (default sample size) do the following iteratively for each k: Ø Simulate exposure and confounders at each time k using estimated model parameters from Step 1. Exception: at k=0 (baseline) assign values as observed values in data set. Ø Reset exposure at k according to user- defined rule g Ø E.g. if simulated fish<3 reset to 3; otherwise do not intervene (threshold intervention) Ø Estimate hazard of event at time k given these generated covariate values using model in Step 1

Algorithm: Step 3 Ø Compute the Risk by end of follow- up for each of the N simulated histories from the N time- varying history- specific hazards. Ø Average these Risks to get final estimate of Risk by end of follow- up under g

Final estimates and CIs Repeat Steps 2 and 3 for each hypothetical intervention. Obtain causal effect estimates from by risk differences/ratios for different g. 95% CIs obtained by repeating whole algorithm in B bootstrap samples.

Fit models save estimated model parameters History 1 under g History 2 under g History N under g Hazard 1 (History 1) Hazard 9 (History 1) Hazard 1 (History 2) Hazard 9 (History 2) Hazard 1 (History N) Hazard 9 (History N) Risk by time 9 under (History 1) Risk by time 9 under (History 2) Risk by time 9 under (History N) Average history- specific Risks to get population Risk under g by end of follow- up

Disadvantages of parametric g- formula Ø Relies heavily on parametric models and subject to related bias Ø Some model misspecification can be theoretically guaranteed when null of no treatment effect is true Ø null paradox (Robins and Wasserman, 1997)

Advantages of parametric g- formula Ø More stable than other methods for continuous exposures and given near positivity violations Ø Occurs when an intervention level of exposure is unlikely for certain observed confounder histories Ø Parametric g- formula handles by heavier reliance on extrapolation Ø Generally, the complexity of algorithm is the same for any choice of g Ø Very little change for complex dynamic rules

PART II: GFORMULA SAS macro

Different types of outcomes Macro supports 3 types of outcomes (outctype) 1. Continuous outcome at end of follow- up time Ø Choose when interest is in t- v exposure effect on outcome mean at end of follow- up Ø E.g. mean blood pressure at 5 years post- baseline Ø outctype =conteofu

Different types of outcomes Macro supports 3 types of outcomes (outctype) 2. Binary outcome at end of follow- up time Ø Choose when interest is in t- v exposure effect on probability that outcome occurs at end of follow- up Ø E.g. Probability of obesity at 5 years post- baseline Ø outctype =bineofu

Different types of outcomes Macro supports 3 types of outcomes (outctype) 3. Time- varying indicator of failure event Ø Choose when interest is in t- v exposure effect on risk by end of follow- up Ø E.g. Risk of CHD by 18 years post- baseline Ø outctype =binsurv

Required structure for input data set Requires a person- time data set with one record per subject and measurement time index Ø Time index (time) must start at 0 (baseline) for each subject and increment by 1 for each subsequent time index. Ø Time index represent a time interval in which covariates are measured Ø Lajous et al.: each time index represents a two- year questionnaire interval

Required structure for input data set Each person-time record will include Ø Time-fixed baseline covariates (e.g. age at baseline, race) Ø Current covariate measurements for that time k (bmi, fish measured in interval k) Ø Time-varying indicator of censoring (e.g. failure to return interval k questionnaire)

Required structure for input data set For outctype=binsurv (Lajous et al.): Ø Will contain a time varying indicator of failure from event of interest for each time index k

Required structure for input data set For outctype=binsurv (Lajous et al.): Ø Time varying indicator of failure on line k can be coded 0, 1 or missing Ø Should be 0 if neither event nor censoring has occurred Ø Should be 1 if event has occurred Ø Should be missing if no event but censoring occurs Ø First line k where outcome is 1 or missing is last line for that subject.

Required structure for input data set Subjects who do not fail and are not censored by end of follow- up will be 0 at all times for censoring and event indicators (outctype=binsurv) Ø Macro parameter timepoints encodes end of follow- up in terms of intervals Ø Lajous et al.: timepoints=9 (9*2 year intervals=18 years) Ø Because time index time starts at 0, can take maximum value of 8

SAMPLE DATA

FEATURES OF BASIC CALL

libname jess '/sasdata/cimpod_2017/jessica_young'; %include '/home/jessica.gerald.young/gformula.sas'; Define permanent libraries Include the file with the macro options notes; *options mprint; data fishdata; set jess.fish; run; Set options for printing in log file Call permanent data set Define interventions %let interv1 =intno=1, intlabel='at least 2 servings of fish at all times', nintvar=1,intvar1=fish, inttype1=2, intmin1=2, intpr1=1, inttimes1= 0 1 2 3 4 5 6 7 8 ; %let interv2 =intno=2, intlabel='at least 3 servings of fish at all times', nintvar=1,intvar1=fish, inttype1=2, intmin1=3, intpr1=1, inttimes1= 0 1 2 3 4 5 6 7 8

%gformula( data=fishdata, id=id, time=time, timeptype = conbin, timepoints=9, outctype=binsurv, outc=death, censlost=censor, numint= 2, fixedcov= race_1 race_2, ncov=2, cov1=cig, cov1otype=3, cov1ptype = lag1bin, cov2=fish, cov2otype=3, cov2ptype=lag1bin, nsamples= 0); Call to GFORMULA macro Input data set Subject identifier from input data set Time index from input data set Specifies function of time for pooled over time models End of follow- up (max value of time should be timepoints- 1) Specifies outcome is t- v binary failure indicator Time- varying failure indicator for event of interest Time- varying censoring indicator Number of interventions to be simulated (minus natural course) Time fixed baseline confounders Number of time- varying covariates (including exposure), up to 30 Time varying covariate 1 Model specifications for t- v covariate 1 Time varying covariate 2 Model specifications for t- v covariate 2 Number of bootstrap samples

Graphical comparisons of natural course versus observed Ø Set macro parameter rungraphs=1 Ø Compares observed risk (nonparametric estimates in censored data) versus parametric g- formula natural course estimates Ø Comparison of observed covariate means versus simulated under natural course. Ø Used to get a sense of presence of gross model misspecification

REVIEW OF OUTPUT

covxotypes For each covx, X=1,,ncov: Ø The macro parameter covxotype selects the SAS regression fitting procedure for the conditional distribution of covx. Ø Also determines how covx is simulated at each time k. Ø Options available for covxotype are summarized in Table 1 of the documentation.

Examples of covxotype Ø covxotype=1, estimates the conditional density of covx via PROC LOGISTIC. Simulation based on estimated model parameters. Ø Might be appropriate for binary variables that can take value 1 or 0 at any time with no restriction. Ø covxotype=2, estimates via PROC LOGISTIC amongst records with lagged value of covx=0. Simulates from the model if last simulated value of covx was 0. If last value was 1, sets covx to 1. Ø Might be appropriate for binary variables that once they switch to 1, they stay 1 (e.g. diagnosis of diabetes by time k)

Examples of covxotype Ø covxotype=3, estimate of conditional density of covx obtained via PROC REG. Simulation based on estimated model parameters under normality assumption. Ø Might be appropriate for continuous variables. Ø covxotype=4, estimates conditional density of covx via two steps: Ø PROC LOGISTIC for whether covx>0 or not Ø PROC REG for records with covx>0 Ø Simulation is in two steps Ø Might be appropriate for continuous variables with zero- heavy tails (e.g. number of cigarettes per day)

Exercise 1 Edit fishcall1.sas 1. Change the otype for time- varying covariate cig to cov1otype=4 2. Add additional baseline confounders: pre- baseline number of cigarettes (cigprebl), pre- baseline high blood pressure? (hbpprebl), pre- bl meat consumption (mtprebl), pre- bl fish consumption (fishprebl)

covxptypes Determines how the history of covx will appear in each model Ø Hazard model Ø Models for covariate distributions Ø Details in Table 2

covxptypes (lag1- prefix) Prefix lag1- (lag1bin, lag1qdc,lag1zqdc,lag1cat,lag1spl) Ø Includes function of one lagged value of covx in covariate models Ø Includes function of current value of covx only in hazard models Ø Function depends on choice of suffix Ø Need to include lagged value of covx in input data set Ø Must be named covx_l1 (e.g. cig_l1 if covx=cig)

covxptypes (suffix options) Suffix options that determine function: Ø lag1bin: identity function (linear assumption when covx is not binary) Ø lag1qdc: quadratic function Ø lag1cat: categorization of variable (must also specify covxknots which give cutoffs for categories) Ø E.g. cov1=cig, cov1ptype=lag1cat,cov1knots= 5 10 15, Ø lag1spl: restricted cubic spline (must also specify covxknots)

covxptypes (lag2- prefix) Prefix lag2- (lag2bin, lag2qdc,lag2zqdc,lag2cat,lag2spl) Ø Includes function of two recent lagged values of covx in covariate models Ø Includes function of current value of covx and covx_l1 only in hazard models Ø Function depends on choice of suffix Ø Need to include two lagged values of covx in input data set Ø Must be named covx_l1 and covx_l2

Other covxptypes cumavg lag1cuma vg lag2cuma vg rcumavg Cumulative average Cumulative average where the last term is pulled off the average Cumulative average where the last two terms are pulled off the average Recent cumulative average Creates and includes the cumulative average of entire history of covx relative to interval k beginning from time=0. A variation of the cumavg ptype where the last term is pulled off of the average. In this case there are two generated predictors. At time = k these will be covx _l1 and the average of covx from time = 0 to time = k- 2. A variation of the cumavg ptype where the last two terms are pulled off of the average. In this case there are two generated predictors. At time = k these will be covx_l1, covx_l2, and the average of covx from time = 0 to time = k- 3. Creates and includes the cumulative average of restricted history of covx relative to interval k based on two most recent values only.

Exercise 2 Edit fishcall1.sas 1. Change the ptype for time- varying covariate cig so models include indicators for categories of first lagged value of cig (can use cutoffs 1, 5 and 9). 2. Add a new time- varying covariate to the call with your choice of ptype and otype: hbp (a time- varying indicator of high- blood pressure in each interval k) 3. Add another new time- varying covariate to the call with your choice of ptype and otype: mt (number of servings of meat in each interval k)

Defining interventions Ø Table 3 in documentation describes different types Ø Do not need to define the natural course (by default this is run and is the default reference for causal contrasts) Ø In a given intervention definition, can include up to 8 exposure variables (variables to undergo intervention) Ø Interventions are defined before the call to the main GFORMULA macro in global macro variables interv1, interv2

Code for threshold intervention on weekly Fish intake eat at least 2 servings per week %let interv1 = intno=1, intlabel='at least 2 servings of fish', nintvar=1, intvar1=fish, inttype1=2, intmin1=2, intpr1=1, inttimes1= 0 1 2 3 4 5 6 7 8 ; Intervention number Intervention label Number of variables to undergo intervention in this intervention First intervention variable Type of intervention on first intervention variable (Table 3) When threshold intervention (inttype1=2), what is the lower threshold Probability to perform this intervention on first intervention variable (default) Intervention times for first intervention var

Code for static intervention on weekly Fish intake eat exactly 2 servings per week %let interv1 = intno=1, intlabel= exactly 2 servings of fish', nintvar=1, intvar1=fish, inttype1=1, intvalue1=2, intpr1=1, inttimes1= 0 1 2 3 4 5 6 7 8 ; Intervention number Intervention label Number of variables to undergo intervention in this intervention First intervention variable Type of intervention on first intervention variable (Table 3) When static intervention (inttype1=1), what value to assign Probability to perform this intervention on first intervention variable (default) Intervention times for first intervention var

Exercise 3 Edit fishcall1.sas 1. Add a third intervention that is a threshold intervention on fish with cutoff at least 4 servings per day 2. Add a fourth intervention that is a joint intervention on mt and fish where meat is always set to exactly 0 servings per day and fish at least 2 servings Hint: remember to change numint from 2 to 4 in main GFORMULA macro call.

covxptypes (skp- prefix) Prefix skp- (skpbin, skpqdc,skpzqdc,skpcat,skpspl) Ø Can be used when covx not measured in certain intervals for anyone and last measured value forward Ø E.g. in Nurses Health Study, certain variables not measured in certain questionnaire years Ø Data coded such that last value carried forward in these years Ø Assumption is that most recent measurement sufficient to ensure NUCS

covxptypes (skp- prefix) Prefix skp- (skpbin, skpqdc,skpzqdc,skpcat,skpspl) Ø Includes function of most recent value of covx and interaction between this value and time since last measured Ø Must specify length of each time interval (interval) Ø E.g. interval=2 (2 year questionnaire interval) Ø Specify values of time in which covx is not measured (covxskip) Ø E.g. cov1skip= 2 5

timeptype Determines functional form of time in pooled over time models: Ø conbin, concat, conqdc, conspl. Ø Follows suffix functions for covxptype Ø For concat and conspl, must define timeknots (the chosen category cutoffs/knots, separated by spaces).