    # Re: st: predict after glm

 From Ronnie Babigumira To statalist@hsphsun2.harvard.edu Subject Re: st: predict after glm Date Mon, 27 Mar 2006 13:53:58 +0200

```Hmmm, then I'm sorry I cant help. I am also on using Windows(XP) and here is my log

. use http://www.stata-press.com/data/r9/beetle

. glm r ldose, f(binomial n) l(logit)

Iteration 0:   log likelihood = -250.49593
Iteration 1:   log likelihood = -221.91214
Iteration 2:   log likelihood = -221.87694
Iteration 3:   log likelihood = -221.87694

Generalized linear models                          No. of obs      =        24
Optimization     : ML                              Residual df     =        22
Scale parameter =         1
Deviance         =  363.6276384                    (1/df) Deviance =  16.52853
Pearson          =  372.2527216                    (1/df) Pearson  =  16.92058

Variance function: V(u) = u*(1-u/n)                [Binomial]
Link function    : g(u) = ln(u/(n-u))              [Logit]

AIC             =  18.65641
Log likelihood   = -221.8769365                    BIC             =  203.7421

------------------------------------------------------------------------------
|                 OIM
r |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
ldose |    22.0699   1.203182    18.34   0.000     19.71171    24.42809
_cons |   -39.7564   2.167708   -18.34   0.000    -44.00503   -35.50777
------------------------------------------------------------------------------

. predict mu_logit
(option mu assumed; predicted mean r)

Thomas Gschwend wrote:
```
```I work with up-to-date SE version on a windows platform

c(stata_version) = 9.1
c(version) = 9.1                        (version)
---------------------------------------------------------------------------------------------------------------------------
c(born_date) = "20 Jan 2006"
c(flavor) = "Intercooled"
c(SE) = 1
c(mode) = ""
c(console) = ""
---------------------------------------------------------------------------------------------------------------------------
c(os) = "Windows"
c(osdtl) = ""
c(machine_type) = "PC"
c(byteorder) = "lohi"

At 13:29 27.03.2006, Ronnie Babigumira wrote:
```
What version of Stata are you using? I cannot reproduce your problem (Im using Stata 9.1,
Born 20 Jan 2006)

Ronnie

Thomas Gschwend wrote:

I tried to replicate the glm postestimation example using the beetle.dta closely following the code presented in the Stata9 Reference manual A-J on page 424. I have two puzzeling observations.
1) the glm model (without the -quitely- option) prompts a warning message: "convergence not achieved" which does not occur when in addition -, irls- is specified.
2)-predict- and -mfx- yield the following error message: "Unknown function /()"
Anybody any ideas?
Thomas
...and the log is:
. use http://www.stata-press.com/data/r9/beetle
. glm r ldose, f(binomial n) l(logit)
initial: log likelihood = -250.49593
rescale: log likelihood = -250.49593
Iteration 0: log likelihood = -250.49593
Iteration 1: log likelihood = -221.91214
Iteration 2: log likelihood = -221.87694
Iteration 3: log likelihood = -221.87694
Generalized linear models No. of obs = 24
Optimization : ML Residual df = 22
Scale parameter = 1
Deviance = 363.6276384 (1/df) Deviance = 16.52853
Pearson = 372.2527216 (1/df) Pearson = 16.92058
Variance function: V(u) = u*(1-u/n) [Binomial]
Link function : g(u) = ln(u/(n-u)) [Logit]
AIC = 18.65641
Log likelihood = -221.8769365 BIC = 203.7421
------------------------------------------------------------------------------
| OIM
r | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
ldose | 22.0699 1.203182 18.34 0.000 19.71171 24.42809
_cons | -39.7564 2.167708 -18.34 0.000 -44.00503 -35.50777
------------------------------------------------------------------------------
Warning: convergence not achieved
. predict mu_logit
Unknown function /()
r(133);
end of do-file
r(133);

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
```*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```
```

********************************************************************
Thomas Gschwend, PhD
Mannheimer Zentrum fuer Europaeische Sozialforschung (MZES)
University of Mannheim
68131 Mannheim
Germany
0621.181.2809 (voice)
0621.181.2845 (fax)
Thomas.Gschwend@mzes.uni-mannheim.de
http://www.sowi.uni-mannheim.de/lehrstuehle/lspol1/gschwend.htm

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

```
```*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```