I've applied logistic regression using glm
in R as follows:
model <- glm(y ~ x, family=binomial(link='logit'), data=training_data)
Now I want to compute the log-likelihood of observing my test data given model
, so I can see if it's doing better than other models.
logLik computes the log-likelihood of observing the training data given the model -- this is precisely the parameter that was maximised during model fitting. But how do I get the log likelihood of observing the test data given the model?