getwd() setwd("C:/Users/Sheri Moinamin/Desktop") #Read data CIT=read.csv("CIT.csv") # View column names colnames(CIT) #Dependent variable is the count of occurrences, which is CITCount #Complete Independence Poisson regression CI=glm(CITCount~(FamilyHxBipolar + FamilyHxDepression + CITSuccess), data=CIT, family=poisson) summary(CI) # Joint Independence BD (Bipolar and Depression) Poisson regression JImodelBD=glm(CITCount ~ (FamilyHxBipolar + FamilyHxDepression + CITSuccess + FamilyHxBipolar * FamilyHxDepression), data=CIT, family=poisson) summary(JImodelBD) #Joint Independence BC (Bipolar and CIT Success) Poisson regression JImodelBC=glm(CITCount ~ (FamilyHxBipolar + FamilyHxDepression + CITSuccess + FamilyHxBipolar * CITSuccess), data=CIT, family=poisson) summary(JImodelBC) #Joint Independence DC (Depression and CIT Success) Poisson regression JImodelDC=glm(CITCount ~ (FamilyHxBipolar + FamilyHxDepression + CITSuccess + FamilyHxDepression * CITSuccess), data=CIT, family=poisson) summary(JImodelDC) # Full Homogenous Poisson regression model # Independent variables are main effects and pairwise variables homogenous=glm(CITCount ~ (FamilyHxBipolar + FamilyHxDepression + CITSuccess)^2, data=CIT, family=poisson) summary(homogenous) # Homogenous Association NoBD model(dropping family history of depression and family history of bipolar) NoBD=update(homogenous,.~.-(FamilyHxBipolar:FamilyHxDepression)) summary(NoBD) # Homogenous Association NoBC model(family history of bipolar and CITSuccess) NoBC=update(homogenous,.~.-(FamilyHxBipolar:CITSuccess)) summary(NoBC) # Homogenous Association NoBC model(family history of depression and CITSuccess) NoDC=update(homogenous,.~.-(FamilyHxDepression:CITSuccess)) summary(NoDC) # Record the residual deviance and degrees of freedom for each model # Record the model with the smallest increase in residual deviance from the full homogenous model