# [R-sig-ME] Logistic regression with spatial autocorrelation structure

Dale Steele dale.w.steele at gmail.com
Mon Jan 31 18:45:20 CET 2011

```Dear mixed-modeling  experts,

I'm interested in modeling the probability of appendicitis in patients
with abdominal pain.

The R binary data file 'http://www.ped-em.org/appy.rda' contains
the following variables from a pilot study of 138 children with
abdominal pain.

'dx'        eventual diagnosis:   0=no appendicitis, 1=appendicitis
'gender'       Male/Female
'wbc'       total white blood cell count
'priorprob'    Clinical predicted probability of appendicitis
'doc'       doctor who assigned 'priorprob'

After taking a history and performing a physical examination, the ER doctor
was asked to make a vertical mark on a 100 mm horizontal line to represent
her estimate of the (percent) probability that the patient had appendicitis.

My initial thought was to fit a multiple logistic regression model:

m1 <- glm(dx ~ gender + priorprob + wbc + doc, family=binomial, data=appy)

However, it seems likely that each doctor interpreted the probability scale
differently.  The 23 doctors evaluated from 1 to 17 patients each. I'm
not primarily interest in predictions by a specific clinician.  Thus,
it seems to make sense to fit a generalized linear mixed model.

At this point I get muddled. Have I correctly specified a random
intercept model (m2) and a random intercept/random slope model (m3)?
Are there other sensible models?

library(lme4)
m2 <- glmer(dx ~ priorprob + gender + wbc + (1 | doc),
family=binomial, data=appy)

m3 <- glmer(dx ~ priorprob + gender  + wbc + (priorprob | doc),
family=binomial, data=appy)

My ultimate goal is to estimate the probability of appendicitis
(and a prediction interval), given a specific 'gender', 'wbc' and
'priorprob' assigned by a doctor with similar diagnostic ability to
those who participated in our pilot study. I'm stuck on how to code this
prediction.

Thanks.

Dale

Dale Steele, MD
Pediatric Emergency Medicine
Hasbro Childrens' Hospital
Providence, RI

```