A log-likelihood function takes on the form of: logL$=\Sigma^{n}_{i=1}(y_ilog(\frac{e^{\beta' x_i}}{1+e^{\beta'x_i}} )+(1-y_i)(\frac{e^{\beta' x_i}}{1+e^{\beta'x_i}})$
My logit model is estimated as follows:
glm.logit=glm(model,binomial(),data)
Estimating $y_i$
yi=data$y
x's as a matrix of the dependent variable
xi=cbind(data$x1+data$x2+...)
Taking the estimates of $\beta$ from my model
betai=coef(glm.logit)
Putting the these together:
xibetai<-xi%*%t(betai)
Estimating the logistic form:
logiti<-exp(xibetai)/(1+exp(xibetai))
Putting everything together in the form of a log-likelihood model:
LogLi<-yi%*%log(logiti)+(1-yi)%*%log(1-logiti)
Issue with the fact that you can't take take the log of a negative value, so I only get about half of my coefficients in the output.
?predict
,?logLik
...) This might be more appropriate for StackOverflow, as it looks more like "how do I compute ... ?" rather than "what should I compute?" or "what does this mean?" $\endgroup$