I want to fit a glm in R. The predictors I am using are let's say 4 variables: Age, Sex, HIV But I want to fit the glm in a way that it only uses those rows of HIV which are equal to 0 and those rows of DM which are equal to 1!
Age<-c(21,20,12,34,19)
Sex<-c(1,1,1,0,1,0)
HIV<c(0,1,1,0,0,0)
DM<-c(1,1,1,1,0,0)
Y<-c(1,1,0,0,1,1)
data<-data.frame(Age,Sex,HIV,DM,Y)
model<-glm(Y~Age+Sex+???????+?????) Should I be writing Y~Age+Sex+(data$HIV==0)+(data$DM==1), or it means that I am setting everyone to 0 and then 1?
P.S: I edited the question after Akrun answered, the initial version just had HIV, Age and Sex