# [R-sig-ME] Using lme4 to predict probability of appendicitis

Gavin Simpson gavin.simpson at ucl.ac.uk
Mon Jan 31 20:56:31 CET 2011

```On Mon, 2011-01-31 at 17:49 +0000, Dale.W.Steele at gmail.com wrote:
> Apologies for the repeat post ... (new subject)

...but you failed to start a new message (and thus get a new message-id)
so most sensible mailers still think your email belongs to the thread
entitled "Logistic regression with spatial autocorrelation structure".

Is it that difficult to start a *new* message and paste in the email

G

> 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
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

```