0
$\begingroup$

I need help with estimated standard errors in SAS. I'm doing logistic regression of and I obtained the score, standard error, pd and lower and upper limit of confidence interval. I also computed these estimates manually for a few observations and I was able to replicate the results for pd and the confidence intervals.

I used following formulas for pd and intervals:

pd=1/(1+exp(-(xbeta)));

up_test=1/(1+exp(-(xbeta+probit(1-0.05/2)*std)));

lo_test=1/(1+exp(-(xbeta-probit(1-0.05/2)*std)));

But when I manually computed the standard error I obtained different results than the ones produced automatically from model.

My question is, what is the formula for standard error used in logistic regression in SAS?

I tried using results from maximum likelihood:

$\sqrt{(se(intercept)^2 + se(score)^2*(score-averagescore)^2}$

, where $se$ is the standard error but it doesn't work.

I hope I described my problem clearly, because i'm not an expert on this. :)

$\endgroup$
2
  • 1
    $\begingroup$ You missed the covariance. $\endgroup$
    – user158565
    Commented Jul 19, 2019 at 13:17
  • $\begingroup$ I am voting to leave this open. It's framed in the context of SAS, but any software will do this. $\endgroup$
    – Peter Flom
    Commented Jul 20, 2019 at 10:30

3 Answers 3

1
$\begingroup$

Following up @Björn and @PeterFlom's answer: you've forgotten (or maybe didn't know) to account for the covariance between the intercept and score-effect estimates. If you want to calculate the standard error of the linear predictor $\beta_0 + \beta_1 x$ (intercept + slope*predictor value), it will be $$ \sqrt{\sigma^2_0 + x^2 \sigma^2_1 + 2 x \sigma_{01}} $$

This is the equivalent of @Björn's answer with $a=1$, $b=x$, $X=\beta_0$, $Y=\beta_1$, or @PeterFlom's answer with $\hat V_b = \left( \begin{array}{cc} \sigma^2_0 & \sigma_{01} \\ \sigma_{01} & \sigma^2_1 \end{array} \right)$.

$\endgroup$
3
  • $\begingroup$ This is the solution that is was looking for. But can you explain me what is σ01 in that covarience matrix? I dont know hot to get it. σo and σ1 are clear for me. $\endgroup$
    – user1101
    Commented Jul 23, 2019 at 10:13
  • $\begingroup$ σ01 is the covariance between the estimates of β0 and β1. It looks like you might use the COVB option to the MODEL statement in PROC GENMOD to get the covariance matrix of the parameters ... ?? $\endgroup$
    – Ben Bolker
    Commented Jul 23, 2019 at 13:43
  • $\begingroup$ Now it works! I found also option COVOUT in PROC LOGISTIC, which also display covariance matrix. Thank you for Your help $\endgroup$
    – user1101
    Commented Jul 23, 2019 at 14:29
2
$\begingroup$

See https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_logistic_sect036.htm

SAS computes the SE of $\eta_i$ as "the square root of the quadratic form $(1,x')\hat{V}_b(1,x')$ where $\hat{V}_b$ is the estimated covariance matrix of the parameter estimates."

Although you framed this as a question about SAS (which would be off topic) I believe that this is not specific to SAS.

$\endgroup$
1
$\begingroup$

It is not really clear what you want SEs for. For an individual model parameter, software will typically use the observed (or asymptotic) Fisher information, which you usually get almost automatically when numerically maximizing the log-likelihood. If we are talking about combinations of parameters such as a SE for a*(parameter 1) + b*(parameter2), then it depends a little on how they are combined. In case of such a simple sum, you can get the SE via the usual formula for how variances add up: $$\text{Var}(aX+bY) = a^2 \text{Var}(X) + b^2 \text{Var}(Y) + 2ab\text{Cov}(X,Y)$$ (of course with the square root taken). For more complex functions than summation, it may be harder and I would guess that most software packages would use the delta method.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.