Hi everyone,
My current goal is to translate a SAS program to R. My issue here is that I can't find the equivalence/how to compute predicted values for a glm model as the ones I get in SAS.
I have found the following explanations in SAS documentation : https://support.sas.com/documentation/cdl/en/statug/63962/HTML/default/viewer.htm#statug_genmod_sect045.htm But I have troubles to translate the formula with a concrete code in R, specially concerning the covariance ...
For now I have computed the CI the following way (I'm working with lists)
# GLM
models <- lapply(combia, function (x) {glm(cbind(n,s-n) ~ scm, family = binomial, data = x)})
# Get confidence intervals
p <- lapply(models, function (x) {predict(x, type = "link", se.fit = TRUE)})
lowerlogit <- lapply(p, function(x) {x$fit - 1.96*x$se.fit})
upperlogit <- lapply(p, function(x) {x$fit + 1.96*x$se.fit})
borneinf <- lapply(lowerlogit, function(x) {exp(x)/(1+exp(x))})
bornesup <- lapply(upperlogit, function(x) {exp(x)/(1+exp(x))})
But I don't get the same CI as SAS, and it's a problem for me in the futures steps.
I hope some of you would be able to help me on that, that would be so helpful !!
Thanks in advance