SlideShare a Scribd company logo
1 of 12
BS835 Class 6 HW exercises
Questions 1 and 2 are from the in-class exercises
(Hypothetical data based broadly on Maslow et.al.,
Reproductive Outcomes Following Maternal Exposure to the
Events of September 11, 2001, at the World Trade Center, in
New York City, AJPH.) To determine the effect of exposure to
the events of 9/11 (including both environmental exposures and
stress-related exposures), exposure data was collected on
n=3,360 women who gave birth to a singleton child in NYC
between Oct. 2001 and December 2010. We will look at any
exposure (categorized as exposed vs. not exposed; the study
looked at different types of exposures as well), and focus on
low birthweight as the adverse outcome potentially related to
exposure. We expect the effect of exposure to be stronger for
babies born in the two years following 9/11, and so we are
interested in potential effect modification.
Hypothetical data are saved in the file ‘WTC Births.xlsx’.
Variables in the data set are:
1) idnum, a study ID number
2) momage, mother’s age at 9/11, categorized and coded as 1
for those under 30 years, 2 for those aged 30 to 35 years, and 3
for those older than 35
3) college, maternal education coded 1 for those with a 4 year
college degree, 0 for those with less than a college degree
4) earlyperiod, coded 1 for births that occurred within 2 years
of 9/11, and 0 for those that occurred more than 2 years after
9/11
5) exposure, maternal exposure to the events from 9/11
6) LBW, low birthweight, coded 1 for infants weighing less than
2,000 grams, 0 for those weighing 2,000 grams or more.
Question 1. Our broad research question is whether a woman’s
exposure to the events of 9/11 had an adverse effect on the
outcome of her pregnancy.
As a preliminary check on the data, 5.2% of the mom’s in the
study had a low birthweight infant.
As a first analysis, fit a multiple logistic regression model with
low birthweight as the outcome variable and exposure, time
period (the earlyperiod variable), maternal age, and maternal
education as predictors. I’ve summarized results in the
following table (you can check to see that your results match
the results in the table):
Variable
aOR
95% CI
Exposed to events of 9/11
Birth within 2 yrs of 9/11
Maternal age
<30 yrs
30 – 35 yrs
>35 yrs
College degree
1.35
1.15
Ref
0.90
0.82
0.43
0.99, 1.84
0.82, 1.61
--
0.62, 1.29
0.53, 1.27
0.31, 0.58
Run a Hosmer-Lemeshow test to check on the fit of the model,
and interpret the results of this Hosmer-Lemeshow test.
Discuss these findings for the exposure variable – was there an
effect of exposure on low birthweight? Explain.
Question 2. The study sample included births from the 10 years
following 9/11. The investigators believe that the effect of
exposure would be strong for women pregnant at the time of
9/11 or shortly after, but that the effect of exposure may weaken
over time. To investigate, run a model including the covariates
from Question 1, but adding an interaction term between
exposure and the ‘earlyperiod’ (birth within 2 years of 9/11)
variable.
Results from the interaction model are given in the table below
(Note this table asks for slopes, not odds ratios).
Check these results using the SAS or R code given
below:
Results of a logistic regression interaction model predicting low
birthweight
Variable
Slope
p-value
for slope
Intercept
Exposed to events of 9/11
Birth within 2 yrs of 9/11
Exposure x Birth within 2 yrs
Maternal age
<30 yrs
30 – 35 yrs
>35 yrs
College degree
-2.360
0.083
-0.227
0.747
Ref
-0.108
-0.196
-0.845
<0.001
0.663
0.376
0.035
--
0.561
0.377
<0.001
The table below focuses on the effect of exposure, during the
early period and during the late period for the study (effect
modification of the effect of exposure by time), from the above
interaction model. See the SAS and R code below. While
results age given by R and SAS
, I think you can calculate the two odds ratios by hand
(with a calculator) from the slopes above – check these
calculations. I think we need to use the computer to get the
confidence intervals for these odds ratios.
Effect of exposure to the events of 9/11 on low birthweight, by
time period of delivery
Time Period
aOR
95% CI for aOR
Birth within 2 years of 9/11
2.29
1.28, 4.12
Birth more than 2 years after 9/11
1.09
0.75, 1.58
Is there effect modification here? Explain (address significance
as well as size of the effect).
Some SAS and R help follow:
SAS code for the interaction model in Question 2
proclogistic;
class momage (ref='1') / param=ref;
model lowBW (event='1') = exposure earlyperiod
exposure*earlyperiod
momage college;
estimate 'Exposure OR early period' exposure
1 exposure*earlyperiod
1
/ exp cl;
estimate 'Exposure OR late period' exposure
1 exposure*earlyperiod
0
/ exp cl;
run;
R code for the interaction model in Question 2
# for later period (earlyperiod = 0)
log.out <- glm(lowBW ~ exposure + earlyperiod +
exposure:earlyperiod +
relevel(factor(momage),ref='1') +
college,family=binomial(link='logit') )
summary(log.out)
exp(coef(log.out))
exp(confint(log.out))
# For contrasts of exposure and interaction terms load
‘multcomp’ package
# R gives slopes and standard error for the early and late effects
# need to convert to ORs and CIs ‘by hand’
library(multcomp)
exp.early <- matrix(c(0,1,0,0,0,0,1),1)
summary(glht(log.out, linfct=exp.early))
exp.late <- matrix(c(0,1,0,0,0,0,0),1)
summary(glht(log.out, linfct=exp.late))
Question 3. We can also test for effect modification through
classical epidemiologic stratification methods, although these
methods don’t allow for controlling for other variables. I used
the Mantel-Haenszel stratification methods (see Class 4
homework, using ‘proc freq’ in SAS and ‘epi.2by2’ in R) to
examine the association between exposure to the events of 9/11
and low-birthweight, controlling for (stratifying by) the
earlyperiod variable. Results are given below:
Results: From SAS, the Breslow-Day test gives chi-square (1
df) of 4.83, p=0.028.
The stratified results for the effect of exposure on low
birthweight were
Early Period: OR = 2.32 (1.30, 4.16)
Late Period: OR = 1.08 (0.74, 1.56).
From R, the Woolf’s test (labeled ‘M-H test of homogeneity of
ORs) gives chi-square (1 df) 4.67, p=0.030.
The stratified results were:
Early Period: OR = 2.31 (1.30, 4.22)
Late Period: OR = 1.08 (0.74, 1.56)
Is there significant evidence of effect modification? Explain.
SAS code:
procfreq; table earlyperiod*exposure*lowBW / all;
run;
R code:
# M-H analysis
epi.2by2(tab.out,method='cohort.count')
# stratified results
oddsratio(table(exposure[earlyperiod==0],lowBW[earlyperiod=
=0]))
oddsratio(table(exposure[earlyperiod==1],lowBW[earlyperiod=
=1]))
Question 4. (I’ve done the computer work and summarized
results in the table below. SAS code and R code that I used is
given at the end of the question.) Significant effect
modification indicates that the association of interest is
different for different subgroups in the study. So, when there is
significant interaction, another way to account for the
interaction is to run separate analyses for the different
subgroups. One nice consequence of this approach is that it
avoids presenting results from interaction models (which can be
more complicated to present).
Run two logistic regressions (I’ve done this, see table), one for
mothers who gave birth within 2 years of 9/11 (earlyperiod=1),
the other for mothers who gave birth after 2 years from 9/11.
Both regressions should predict low birthweight from exposure,
mom’s age, and mom’s college education. (Note that
‘earlyperiod’ and the interaction term are not included in these
models, since the analysis is being done stratified by
earlyperiod.) Some SAS and R help is given below.
Results are summarized in the following table:
Results of separate logistic regressions predicting low-
birthweight, for women giving birth within 2 years of 9/11 and
for women giving birth more than 2 years after 9/11
Birth within 2 years of 9/11
(n=840)
Birth more than 2 years after 9/11
(n=2520)
Variable
aOR
95% CI
aOR
95% CI
Exposed to events of 9/11
Maternal age
<30 yrs
30 – 35 yrs
>35 yrs
College degree
2.30
Ref
0.72
0.82
0.44
1.29, 4.19
--
0.37, 1.42
0.36, 1.77
0.25, 0.79
1.09
Ref
0.98
0.83
0.42
0.74, 1.57
--
0.64, 1.54
0.49, 1.40
0.29, 0.61
Based on these analyses, describe the effect of exposure, for
mothers giving birth either within 2 years or after 2 years from
9/11.
SAS code and R code are below.
Some SAS help:
There are several ways to run a sub-group analysis in SAS. I’ll
use the ‘where’ statement, which can be used with most procs,
to restrict the analysis to a subgroup.
title ‘Analysis for births within 2 years of 9/11’;
proclogistic; where earlyperiod=1;
class momage (ref='1') / param=ref;
model lowBW (event='1') = exposure momage college;
run;
title ‘Analysis for births after 2 years of 9/11’;
proclogistic; where earlyperiod=0;
class momage (ref='1') / param=ref;
model lowBW (event='1') = exposure momage college;
run;
The ‘where’ statement restricts an analysis to the subset of
subjects who satisfy the stated condition.
Some R help:
There are several ways to run a sub-group analysis in R. I’ll
use what I think of as a ‘select if’ statement, parallel to the
‘where’ statement in SAS. R uses square brackets following a
variable name to indicate that only subjects who satisfy the
condition in the square brackets should be included in the
analysis. One somewhat awkward consequence of this is that
the square brackets need to be included with every variable
referenced in the procedure.
log.out1 <- glm(lowBW[earlyperiod==1] ~
exposure[earlyperiod==1] +
relevel(factor(momage[earlyperiod==1]),ref='1') +
college[earlyperiod==1],
family=binomial(link='logit') )
summary(log.out1)
exp(coef(log.out1))
exp(confint(log.out1))
log.out0 <- glm(lowBW[earlyperiod==0] ~
exposure[earlyperiod==0] +
relevel(factor(momage[earlyperiod==0]),ref='1') +
college[earlyperiod==0],
family=binomial(link='logit') )
summary(log.out0)
exp(coef(log.out0))
exp(confint(log.out0))Note that two equal signs, ‘==’ are
needed to specify an equality in the ‘select if’ statement in the
square brackets.
BS835 Class 6 HW exercisesQuestions 1 and 2 are from the in-clas.docx

More Related Content

Similar to BS835 Class 6 HW exercisesQuestions 1 and 2 are from the in-clas.docx

logistic regression analysis
logistic regression analysislogistic regression analysis
logistic regression analysisVinya P
 
An Extension of Calderón Transfer Principle and its Application to Ergodic Ma...
An Extension of Calderón Transfer Principle and its Application to Ergodic Ma...An Extension of Calderón Transfer Principle and its Application to Ergodic Ma...
An Extension of Calderón Transfer Principle and its Application to Ergodic Ma...BRNSS Publication Hub
 
Da gs for_commonbiases2
Da gs for_commonbiases2Da gs for_commonbiases2
Da gs for_commonbiases2mglymour
 
CHAPTER NINE Steady States and Transitions THE STEADY-
CHAPTER NINE Steady States and Transitions THE STEADY-CHAPTER NINE Steady States and Transitions THE STEADY-
CHAPTER NINE Steady States and Transitions THE STEADY-JinElias52
 
Are age and week of first symptoms significant predictors
Are age and week of first symptoms significant predictors Are age and week of first symptoms significant predictors
Are age and week of first symptoms significant predictors GORDONOGWEYO
 
2 way ANOVA(Analysis Of VAriance
2 way ANOVA(Analysis Of VAriance2 way ANOVA(Analysis Of VAriance
2 way ANOVA(Analysis Of VAriancemusadoto
 
11 T(EA) FOR TWO TESTS BETWEEN THE MEANS OF DIFFERENT GROUPS11 .docx
11 T(EA) FOR TWO TESTS BETWEEN THE MEANS OF DIFFERENT GROUPS11 .docx11 T(EA) FOR TWO TESTS BETWEEN THE MEANS OF DIFFERENT GROUPS11 .docx
11 T(EA) FOR TWO TESTS BETWEEN THE MEANS OF DIFFERENT GROUPS11 .docxnovabroom
 
11 T(EA) FOR TWO TESTS BETWEEN THE MEANS OF DIFFERENT GROUPS11 .docx
11 T(EA) FOR TWO TESTS BETWEEN THE MEANS OF DIFFERENT GROUPS11 .docx11 T(EA) FOR TWO TESTS BETWEEN THE MEANS OF DIFFERENT GROUPS11 .docx
11 T(EA) FOR TWO TESTS BETWEEN THE MEANS OF DIFFERENT GROUPS11 .docxhyacinthshackley2629
 
Computational Pool-Testing with Retesting Strategy
Computational Pool-Testing with Retesting StrategyComputational Pool-Testing with Retesting Strategy
Computational Pool-Testing with Retesting StrategyWaqas Tariq
 
MultipleLinearRegressionPaper
MultipleLinearRegressionPaperMultipleLinearRegressionPaper
MultipleLinearRegressionPaperKatie Harvey
 
ASPR 2009 Presentation on 02.12.09 (Tony Machin)
ASPR 2009 Presentation on 02.12.09 (Tony Machin)ASPR 2009 Presentation on 02.12.09 (Tony Machin)
ASPR 2009 Presentation on 02.12.09 (Tony Machin)Tony Machin
 
Aspr 2009 Presentation (Tony Machin)
Aspr 2009 Presentation (Tony Machin)Aspr 2009 Presentation (Tony Machin)
Aspr 2009 Presentation (Tony Machin)guestaedf29
 
Section 1 Data File DescriptionThe fictional data represents a te.docx
Section 1 Data File DescriptionThe fictional data represents a te.docxSection 1 Data File DescriptionThe fictional data represents a te.docx
Section 1 Data File DescriptionThe fictional data represents a te.docxbagotjesusa
 
Model for Predicting Prisoner Recidivism
Model for Predicting Prisoner RecidivismModel for Predicting Prisoner Recidivism
Model for Predicting Prisoner RecidivismHira Nadeem
 

Similar to BS835 Class 6 HW exercisesQuestions 1 and 2 are from the in-clas.docx (20)

logistic regression analysis
logistic regression analysislogistic regression analysis
logistic regression analysis
 
PCE Poster 2016
PCE Poster 2016PCE Poster 2016
PCE Poster 2016
 
gh
ghgh
gh
 
Statistics-1.ppt
Statistics-1.pptStatistics-1.ppt
Statistics-1.ppt
 
03_AJMS_241_19.pdf
03_AJMS_241_19.pdf03_AJMS_241_19.pdf
03_AJMS_241_19.pdf
 
An Extension of Calderón Transfer Principle and its Application to Ergodic Ma...
An Extension of Calderón Transfer Principle and its Application to Ergodic Ma...An Extension of Calderón Transfer Principle and its Application to Ergodic Ma...
An Extension of Calderón Transfer Principle and its Application to Ergodic Ma...
 
Da gs for_commonbiases2
Da gs for_commonbiases2Da gs for_commonbiases2
Da gs for_commonbiases2
 
CHAPTER NINE Steady States and Transitions THE STEADY-
CHAPTER NINE Steady States and Transitions THE STEADY-CHAPTER NINE Steady States and Transitions THE STEADY-
CHAPTER NINE Steady States and Transitions THE STEADY-
 
Are age and week of first symptoms significant predictors
Are age and week of first symptoms significant predictors Are age and week of first symptoms significant predictors
Are age and week of first symptoms significant predictors
 
2 way ANOVA(Analysis Of VAriance
2 way ANOVA(Analysis Of VAriance2 way ANOVA(Analysis Of VAriance
2 way ANOVA(Analysis Of VAriance
 
11 T(EA) FOR TWO TESTS BETWEEN THE MEANS OF DIFFERENT GROUPS11 .docx
11 T(EA) FOR TWO TESTS BETWEEN THE MEANS OF DIFFERENT GROUPS11 .docx11 T(EA) FOR TWO TESTS BETWEEN THE MEANS OF DIFFERENT GROUPS11 .docx
11 T(EA) FOR TWO TESTS BETWEEN THE MEANS OF DIFFERENT GROUPS11 .docx
 
11 T(EA) FOR TWO TESTS BETWEEN THE MEANS OF DIFFERENT GROUPS11 .docx
11 T(EA) FOR TWO TESTS BETWEEN THE MEANS OF DIFFERENT GROUPS11 .docx11 T(EA) FOR TWO TESTS BETWEEN THE MEANS OF DIFFERENT GROUPS11 .docx
11 T(EA) FOR TWO TESTS BETWEEN THE MEANS OF DIFFERENT GROUPS11 .docx
 
Ca32486491
Ca32486491Ca32486491
Ca32486491
 
Ca32486491
Ca32486491Ca32486491
Ca32486491
 
Computational Pool-Testing with Retesting Strategy
Computational Pool-Testing with Retesting StrategyComputational Pool-Testing with Retesting Strategy
Computational Pool-Testing with Retesting Strategy
 
MultipleLinearRegressionPaper
MultipleLinearRegressionPaperMultipleLinearRegressionPaper
MultipleLinearRegressionPaper
 
ASPR 2009 Presentation on 02.12.09 (Tony Machin)
ASPR 2009 Presentation on 02.12.09 (Tony Machin)ASPR 2009 Presentation on 02.12.09 (Tony Machin)
ASPR 2009 Presentation on 02.12.09 (Tony Machin)
 
Aspr 2009 Presentation (Tony Machin)
Aspr 2009 Presentation (Tony Machin)Aspr 2009 Presentation (Tony Machin)
Aspr 2009 Presentation (Tony Machin)
 
Section 1 Data File DescriptionThe fictional data represents a te.docx
Section 1 Data File DescriptionThe fictional data represents a te.docxSection 1 Data File DescriptionThe fictional data represents a te.docx
Section 1 Data File DescriptionThe fictional data represents a te.docx
 
Model for Predicting Prisoner Recidivism
Model for Predicting Prisoner RecidivismModel for Predicting Prisoner Recidivism
Model for Predicting Prisoner Recidivism
 

More from bartholomeocoombs

CompetencyAnalyze how human resource standards and practices.docx
CompetencyAnalyze how human resource standards and practices.docxCompetencyAnalyze how human resource standards and practices.docx
CompetencyAnalyze how human resource standards and practices.docxbartholomeocoombs
 
CompetencyAnalyze financial statements to assess performance.docx
CompetencyAnalyze financial statements to assess performance.docxCompetencyAnalyze financial statements to assess performance.docx
CompetencyAnalyze financial statements to assess performance.docxbartholomeocoombs
 
CompetencyAnalyze ethical and legal dilemmas that healthcare.docx
CompetencyAnalyze ethical and legal dilemmas that healthcare.docxCompetencyAnalyze ethical and legal dilemmas that healthcare.docx
CompetencyAnalyze ethical and legal dilemmas that healthcare.docxbartholomeocoombs
 
CompetencyAnalyze ethical and legal dilemmas that healthcare wor.docx
CompetencyAnalyze ethical and legal dilemmas that healthcare wor.docxCompetencyAnalyze ethical and legal dilemmas that healthcare wor.docx
CompetencyAnalyze ethical and legal dilemmas that healthcare wor.docxbartholomeocoombs
 
CompetencyAnalyze collaboration tools to support organizatio.docx
CompetencyAnalyze collaboration tools to support organizatio.docxCompetencyAnalyze collaboration tools to support organizatio.docx
CompetencyAnalyze collaboration tools to support organizatio.docxbartholomeocoombs
 
Competency Checklist and Professional Development Resources .docx
Competency Checklist and Professional Development Resources .docxCompetency Checklist and Professional Development Resources .docx
Competency Checklist and Professional Development Resources .docxbartholomeocoombs
 
Competency 6 Enagage with Communities and Organizations (3 hrs) (1 .docx
Competency 6 Enagage with Communities and Organizations (3 hrs) (1 .docxCompetency 6 Enagage with Communities and Organizations (3 hrs) (1 .docx
Competency 6 Enagage with Communities and Organizations (3 hrs) (1 .docxbartholomeocoombs
 
Competency 2 Examine the organizational behavior within busines.docx
Competency 2 Examine the organizational behavior within busines.docxCompetency 2 Examine the organizational behavior within busines.docx
Competency 2 Examine the organizational behavior within busines.docxbartholomeocoombs
 
CompetenciesEvaluate the challenges and benefits of employ.docx
CompetenciesEvaluate the challenges and benefits of employ.docxCompetenciesEvaluate the challenges and benefits of employ.docx
CompetenciesEvaluate the challenges and benefits of employ.docxbartholomeocoombs
 
CompetenciesDescribe the supply chain management principle.docx
CompetenciesDescribe the supply chain management principle.docxCompetenciesDescribe the supply chain management principle.docx
CompetenciesDescribe the supply chain management principle.docxbartholomeocoombs
 
CompetenciesABCDF1.1 Create oral, written, or visual .docx
CompetenciesABCDF1.1 Create oral, written, or visual .docxCompetenciesABCDF1.1 Create oral, written, or visual .docx
CompetenciesABCDF1.1 Create oral, written, or visual .docxbartholomeocoombs
 
COMPETENCIES734.3.4 Healthcare Utilization and Finance.docx
COMPETENCIES734.3.4  Healthcare Utilization and Finance.docxCOMPETENCIES734.3.4  Healthcare Utilization and Finance.docx
COMPETENCIES734.3.4 Healthcare Utilization and Finance.docxbartholomeocoombs
 
Competencies and KnowledgeWhat competencies were you able to dev.docx
Competencies and KnowledgeWhat competencies were you able to dev.docxCompetencies and KnowledgeWhat competencies were you able to dev.docx
Competencies and KnowledgeWhat competencies were you able to dev.docxbartholomeocoombs
 
Competencies and KnowledgeThis assignment has 2 parts.docx
Competencies and KnowledgeThis assignment has 2 parts.docxCompetencies and KnowledgeThis assignment has 2 parts.docx
Competencies and KnowledgeThis assignment has 2 parts.docxbartholomeocoombs
 
Competencies and KnowledgeThis assignment has 2 partsWhat.docx
Competencies and KnowledgeThis assignment has 2 partsWhat.docxCompetencies and KnowledgeThis assignment has 2 partsWhat.docx
Competencies and KnowledgeThis assignment has 2 partsWhat.docxbartholomeocoombs
 
Competences, Learning Theories and MOOCsRecent Developments.docx
Competences, Learning Theories and MOOCsRecent Developments.docxCompetences, Learning Theories and MOOCsRecent Developments.docx
Competences, Learning Theories and MOOCsRecent Developments.docxbartholomeocoombs
 
Compensation  & Benefits Class 700 words with referencesA stra.docx
Compensation  & Benefits Class 700 words with referencesA stra.docxCompensation  & Benefits Class 700 words with referencesA stra.docx
Compensation  & Benefits Class 700 words with referencesA stra.docxbartholomeocoombs
 
Compensation, Benefits, Reward & Recognition Plan for V..docx
Compensation, Benefits, Reward & Recognition Plan for V..docxCompensation, Benefits, Reward & Recognition Plan for V..docx
Compensation, Benefits, Reward & Recognition Plan for V..docxbartholomeocoombs
 
Compete the following tablesTheoryKey figuresKey concepts o.docx
Compete the following tablesTheoryKey figuresKey concepts o.docxCompete the following tablesTheoryKey figuresKey concepts o.docx
Compete the following tablesTheoryKey figuresKey concepts o.docxbartholomeocoombs
 
Compensation Strategy for Knowledge WorkersTo prepare for this a.docx
Compensation Strategy for Knowledge WorkersTo prepare for this a.docxCompensation Strategy for Knowledge WorkersTo prepare for this a.docx
Compensation Strategy for Knowledge WorkersTo prepare for this a.docxbartholomeocoombs
 

More from bartholomeocoombs (20)

CompetencyAnalyze how human resource standards and practices.docx
CompetencyAnalyze how human resource standards and practices.docxCompetencyAnalyze how human resource standards and practices.docx
CompetencyAnalyze how human resource standards and practices.docx
 
CompetencyAnalyze financial statements to assess performance.docx
CompetencyAnalyze financial statements to assess performance.docxCompetencyAnalyze financial statements to assess performance.docx
CompetencyAnalyze financial statements to assess performance.docx
 
CompetencyAnalyze ethical and legal dilemmas that healthcare.docx
CompetencyAnalyze ethical and legal dilemmas that healthcare.docxCompetencyAnalyze ethical and legal dilemmas that healthcare.docx
CompetencyAnalyze ethical and legal dilemmas that healthcare.docx
 
CompetencyAnalyze ethical and legal dilemmas that healthcare wor.docx
CompetencyAnalyze ethical and legal dilemmas that healthcare wor.docxCompetencyAnalyze ethical and legal dilemmas that healthcare wor.docx
CompetencyAnalyze ethical and legal dilemmas that healthcare wor.docx
 
CompetencyAnalyze collaboration tools to support organizatio.docx
CompetencyAnalyze collaboration tools to support organizatio.docxCompetencyAnalyze collaboration tools to support organizatio.docx
CompetencyAnalyze collaboration tools to support organizatio.docx
 
Competency Checklist and Professional Development Resources .docx
Competency Checklist and Professional Development Resources .docxCompetency Checklist and Professional Development Resources .docx
Competency Checklist and Professional Development Resources .docx
 
Competency 6 Enagage with Communities and Organizations (3 hrs) (1 .docx
Competency 6 Enagage with Communities and Organizations (3 hrs) (1 .docxCompetency 6 Enagage with Communities and Organizations (3 hrs) (1 .docx
Competency 6 Enagage with Communities and Organizations (3 hrs) (1 .docx
 
Competency 2 Examine the organizational behavior within busines.docx
Competency 2 Examine the organizational behavior within busines.docxCompetency 2 Examine the organizational behavior within busines.docx
Competency 2 Examine the organizational behavior within busines.docx
 
CompetenciesEvaluate the challenges and benefits of employ.docx
CompetenciesEvaluate the challenges and benefits of employ.docxCompetenciesEvaluate the challenges and benefits of employ.docx
CompetenciesEvaluate the challenges and benefits of employ.docx
 
CompetenciesDescribe the supply chain management principle.docx
CompetenciesDescribe the supply chain management principle.docxCompetenciesDescribe the supply chain management principle.docx
CompetenciesDescribe the supply chain management principle.docx
 
CompetenciesABCDF1.1 Create oral, written, or visual .docx
CompetenciesABCDF1.1 Create oral, written, or visual .docxCompetenciesABCDF1.1 Create oral, written, or visual .docx
CompetenciesABCDF1.1 Create oral, written, or visual .docx
 
COMPETENCIES734.3.4 Healthcare Utilization and Finance.docx
COMPETENCIES734.3.4  Healthcare Utilization and Finance.docxCOMPETENCIES734.3.4  Healthcare Utilization and Finance.docx
COMPETENCIES734.3.4 Healthcare Utilization and Finance.docx
 
Competencies and KnowledgeWhat competencies were you able to dev.docx
Competencies and KnowledgeWhat competencies were you able to dev.docxCompetencies and KnowledgeWhat competencies were you able to dev.docx
Competencies and KnowledgeWhat competencies were you able to dev.docx
 
Competencies and KnowledgeThis assignment has 2 parts.docx
Competencies and KnowledgeThis assignment has 2 parts.docxCompetencies and KnowledgeThis assignment has 2 parts.docx
Competencies and KnowledgeThis assignment has 2 parts.docx
 
Competencies and KnowledgeThis assignment has 2 partsWhat.docx
Competencies and KnowledgeThis assignment has 2 partsWhat.docxCompetencies and KnowledgeThis assignment has 2 partsWhat.docx
Competencies and KnowledgeThis assignment has 2 partsWhat.docx
 
Competences, Learning Theories and MOOCsRecent Developments.docx
Competences, Learning Theories and MOOCsRecent Developments.docxCompetences, Learning Theories and MOOCsRecent Developments.docx
Competences, Learning Theories and MOOCsRecent Developments.docx
 
Compensation  & Benefits Class 700 words with referencesA stra.docx
Compensation  & Benefits Class 700 words with referencesA stra.docxCompensation  & Benefits Class 700 words with referencesA stra.docx
Compensation  & Benefits Class 700 words with referencesA stra.docx
 
Compensation, Benefits, Reward & Recognition Plan for V..docx
Compensation, Benefits, Reward & Recognition Plan for V..docxCompensation, Benefits, Reward & Recognition Plan for V..docx
Compensation, Benefits, Reward & Recognition Plan for V..docx
 
Compete the following tablesTheoryKey figuresKey concepts o.docx
Compete the following tablesTheoryKey figuresKey concepts o.docxCompete the following tablesTheoryKey figuresKey concepts o.docx
Compete the following tablesTheoryKey figuresKey concepts o.docx
 
Compensation Strategy for Knowledge WorkersTo prepare for this a.docx
Compensation Strategy for Knowledge WorkersTo prepare for this a.docxCompensation Strategy for Knowledge WorkersTo prepare for this a.docx
Compensation Strategy for Knowledge WorkersTo prepare for this a.docx
 

Recently uploaded

24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...Nguyen Thanh Tu Collection
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjMohammed Sikander
 
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...Gary Wood
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismDabee Kamal
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxneillewis46
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...EADTU
 
Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxAdelaideRefugio
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024Borja Sotomayor
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....Ritu480198
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project researchCaitlinCummins3
 
e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi RajagopalEADTU
 
MOOD STABLIZERS DRUGS.pptx
MOOD     STABLIZERS           DRUGS.pptxMOOD     STABLIZERS           DRUGS.pptx
MOOD STABLIZERS DRUGS.pptxPoojaSen20
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesAmanpreetKaur157993
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17Celine George
 
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxAnalyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxLimon Prince
 
demyelinated disorder: multiple sclerosis.pptx
demyelinated disorder: multiple sclerosis.pptxdemyelinated disorder: multiple sclerosis.pptx
demyelinated disorder: multiple sclerosis.pptxMohamed Rizk Khodair
 
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportDenish Jangid
 
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...Nguyen Thanh Tu Collection
 

Recently uploaded (20)

24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
Including Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdfIncluding Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdf
 
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in Hinduism
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptx
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptx
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 
e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopal
 
MOOD STABLIZERS DRUGS.pptx
MOOD     STABLIZERS           DRUGS.pptxMOOD     STABLIZERS           DRUGS.pptx
MOOD STABLIZERS DRUGS.pptx
 
Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategies
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17
 
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxAnalyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
 
demyelinated disorder: multiple sclerosis.pptx
demyelinated disorder: multiple sclerosis.pptxdemyelinated disorder: multiple sclerosis.pptx
demyelinated disorder: multiple sclerosis.pptx
 
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
 
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
 

BS835 Class 6 HW exercisesQuestions 1 and 2 are from the in-clas.docx

  • 1. BS835 Class 6 HW exercises Questions 1 and 2 are from the in-class exercises (Hypothetical data based broadly on Maslow et.al., Reproductive Outcomes Following Maternal Exposure to the Events of September 11, 2001, at the World Trade Center, in New York City, AJPH.) To determine the effect of exposure to the events of 9/11 (including both environmental exposures and stress-related exposures), exposure data was collected on n=3,360 women who gave birth to a singleton child in NYC between Oct. 2001 and December 2010. We will look at any exposure (categorized as exposed vs. not exposed; the study looked at different types of exposures as well), and focus on low birthweight as the adverse outcome potentially related to exposure. We expect the effect of exposure to be stronger for babies born in the two years following 9/11, and so we are interested in potential effect modification. Hypothetical data are saved in the file ‘WTC Births.xlsx’. Variables in the data set are: 1) idnum, a study ID number 2) momage, mother’s age at 9/11, categorized and coded as 1 for those under 30 years, 2 for those aged 30 to 35 years, and 3 for those older than 35 3) college, maternal education coded 1 for those with a 4 year college degree, 0 for those with less than a college degree 4) earlyperiod, coded 1 for births that occurred within 2 years of 9/11, and 0 for those that occurred more than 2 years after 9/11 5) exposure, maternal exposure to the events from 9/11 6) LBW, low birthweight, coded 1 for infants weighing less than 2,000 grams, 0 for those weighing 2,000 grams or more.
  • 2. Question 1. Our broad research question is whether a woman’s exposure to the events of 9/11 had an adverse effect on the outcome of her pregnancy. As a preliminary check on the data, 5.2% of the mom’s in the study had a low birthweight infant. As a first analysis, fit a multiple logistic regression model with low birthweight as the outcome variable and exposure, time period (the earlyperiod variable), maternal age, and maternal education as predictors. I’ve summarized results in the following table (you can check to see that your results match the results in the table): Variable aOR 95% CI Exposed to events of 9/11 Birth within 2 yrs of 9/11 Maternal age <30 yrs 30 – 35 yrs >35 yrs College degree 1.35 1.15 Ref 0.90 0.82 0.43 0.99, 1.84 0.82, 1.61 --
  • 3. 0.62, 1.29 0.53, 1.27 0.31, 0.58 Run a Hosmer-Lemeshow test to check on the fit of the model, and interpret the results of this Hosmer-Lemeshow test. Discuss these findings for the exposure variable – was there an effect of exposure on low birthweight? Explain. Question 2. The study sample included births from the 10 years following 9/11. The investigators believe that the effect of exposure would be strong for women pregnant at the time of 9/11 or shortly after, but that the effect of exposure may weaken over time. To investigate, run a model including the covariates from Question 1, but adding an interaction term between exposure and the ‘earlyperiod’ (birth within 2 years of 9/11) variable. Results from the interaction model are given in the table below (Note this table asks for slopes, not odds ratios). Check these results using the SAS or R code given below: Results of a logistic regression interaction model predicting low birthweight Variable
  • 4. Slope p-value for slope Intercept Exposed to events of 9/11 Birth within 2 yrs of 9/11 Exposure x Birth within 2 yrs Maternal age <30 yrs 30 – 35 yrs >35 yrs College degree -2.360 0.083 -0.227 0.747 Ref -0.108 -0.196 -0.845 <0.001 0.663 0.376 0.035 -- 0.561 0.377 <0.001 The table below focuses on the effect of exposure, during the
  • 5. early period and during the late period for the study (effect modification of the effect of exposure by time), from the above interaction model. See the SAS and R code below. While results age given by R and SAS , I think you can calculate the two odds ratios by hand (with a calculator) from the slopes above – check these calculations. I think we need to use the computer to get the confidence intervals for these odds ratios. Effect of exposure to the events of 9/11 on low birthweight, by time period of delivery Time Period aOR 95% CI for aOR Birth within 2 years of 9/11 2.29 1.28, 4.12 Birth more than 2 years after 9/11 1.09 0.75, 1.58 Is there effect modification here? Explain (address significance as well as size of the effect). Some SAS and R help follow: SAS code for the interaction model in Question 2 proclogistic; class momage (ref='1') / param=ref; model lowBW (event='1') = exposure earlyperiod
  • 6. exposure*earlyperiod momage college; estimate 'Exposure OR early period' exposure 1 exposure*earlyperiod 1 / exp cl; estimate 'Exposure OR late period' exposure 1 exposure*earlyperiod 0 / exp cl; run; R code for the interaction model in Question 2 # for later period (earlyperiod = 0) log.out <- glm(lowBW ~ exposure + earlyperiod + exposure:earlyperiod + relevel(factor(momage),ref='1') + college,family=binomial(link='logit') ) summary(log.out) exp(coef(log.out)) exp(confint(log.out)) # For contrasts of exposure and interaction terms load ‘multcomp’ package # R gives slopes and standard error for the early and late effects # need to convert to ORs and CIs ‘by hand’ library(multcomp) exp.early <- matrix(c(0,1,0,0,0,0,1),1) summary(glht(log.out, linfct=exp.early))
  • 7. exp.late <- matrix(c(0,1,0,0,0,0,0),1) summary(glht(log.out, linfct=exp.late)) Question 3. We can also test for effect modification through classical epidemiologic stratification methods, although these methods don’t allow for controlling for other variables. I used the Mantel-Haenszel stratification methods (see Class 4 homework, using ‘proc freq’ in SAS and ‘epi.2by2’ in R) to examine the association between exposure to the events of 9/11 and low-birthweight, controlling for (stratifying by) the earlyperiod variable. Results are given below: Results: From SAS, the Breslow-Day test gives chi-square (1 df) of 4.83, p=0.028. The stratified results for the effect of exposure on low birthweight were Early Period: OR = 2.32 (1.30, 4.16) Late Period: OR = 1.08 (0.74, 1.56). From R, the Woolf’s test (labeled ‘M-H test of homogeneity of ORs) gives chi-square (1 df) 4.67, p=0.030. The stratified results were: Early Period: OR = 2.31 (1.30, 4.22) Late Period: OR = 1.08 (0.74, 1.56) Is there significant evidence of effect modification? Explain. SAS code: procfreq; table earlyperiod*exposure*lowBW / all; run; R code: # M-H analysis
  • 8. epi.2by2(tab.out,method='cohort.count') # stratified results oddsratio(table(exposure[earlyperiod==0],lowBW[earlyperiod= =0])) oddsratio(table(exposure[earlyperiod==1],lowBW[earlyperiod= =1])) Question 4. (I’ve done the computer work and summarized results in the table below. SAS code and R code that I used is given at the end of the question.) Significant effect modification indicates that the association of interest is different for different subgroups in the study. So, when there is significant interaction, another way to account for the interaction is to run separate analyses for the different subgroups. One nice consequence of this approach is that it avoids presenting results from interaction models (which can be more complicated to present). Run two logistic regressions (I’ve done this, see table), one for mothers who gave birth within 2 years of 9/11 (earlyperiod=1), the other for mothers who gave birth after 2 years from 9/11. Both regressions should predict low birthweight from exposure, mom’s age, and mom’s college education. (Note that ‘earlyperiod’ and the interaction term are not included in these models, since the analysis is being done stratified by earlyperiod.) Some SAS and R help is given below. Results are summarized in the following table: Results of separate logistic regressions predicting low-
  • 9. birthweight, for women giving birth within 2 years of 9/11 and for women giving birth more than 2 years after 9/11 Birth within 2 years of 9/11 (n=840) Birth more than 2 years after 9/11 (n=2520) Variable aOR 95% CI aOR 95% CI Exposed to events of 9/11 Maternal age <30 yrs 30 – 35 yrs >35 yrs College degree 2.30 Ref 0.72 0.82 0.44 1.29, 4.19 -- 0.37, 1.42 0.36, 1.77 0.25, 0.79 1.09 Ref 0.98 0.83 0.42
  • 10. 0.74, 1.57 -- 0.64, 1.54 0.49, 1.40 0.29, 0.61 Based on these analyses, describe the effect of exposure, for mothers giving birth either within 2 years or after 2 years from 9/11. SAS code and R code are below. Some SAS help: There are several ways to run a sub-group analysis in SAS. I’ll use the ‘where’ statement, which can be used with most procs, to restrict the analysis to a subgroup. title ‘Analysis for births within 2 years of 9/11’; proclogistic; where earlyperiod=1; class momage (ref='1') / param=ref; model lowBW (event='1') = exposure momage college; run; title ‘Analysis for births after 2 years of 9/11’; proclogistic; where earlyperiod=0; class momage (ref='1') / param=ref; model lowBW (event='1') = exposure momage college; run; The ‘where’ statement restricts an analysis to the subset of
  • 11. subjects who satisfy the stated condition. Some R help: There are several ways to run a sub-group analysis in R. I’ll use what I think of as a ‘select if’ statement, parallel to the ‘where’ statement in SAS. R uses square brackets following a variable name to indicate that only subjects who satisfy the condition in the square brackets should be included in the analysis. One somewhat awkward consequence of this is that the square brackets need to be included with every variable referenced in the procedure. log.out1 <- glm(lowBW[earlyperiod==1] ~ exposure[earlyperiod==1] + relevel(factor(momage[earlyperiod==1]),ref='1') + college[earlyperiod==1], family=binomial(link='logit') ) summary(log.out1) exp(coef(log.out1)) exp(confint(log.out1)) log.out0 <- glm(lowBW[earlyperiod==0] ~ exposure[earlyperiod==0] + relevel(factor(momage[earlyperiod==0]),ref='1') + college[earlyperiod==0], family=binomial(link='logit') ) summary(log.out0) exp(coef(log.out0)) exp(confint(log.out0))Note that two equal signs, ‘==’ are needed to specify an equality in the ‘select if’ statement in the square brackets.