I have a dataset with 3240 observations in 16 different countries. I would like to run 16 separate logistic models for each country, as I expect the effect of my predictor variable to vary between the countries.
Data <- data.frame(
X = sample(1:100),
Y = sample(c("yes", "no"), 100, replace=TRUE),
country=sample(c("UK","USA","Denmark","Norway","Iceland","Ireland","Sweden","Italy","France","Germany","Luxembourg","Belgium","Netherlands","Spain","Portugal","Greece"),100, replace=TRUE))
How to do this in R?