[R] Interpretation of loess

Damon Wischik djw1005 at cam.ac.uk
Fri Jun 27 18:53:34 CEST 2003


I have data on a number of patients. Essentially, for each patient I know
his/her age and whether he/she exhibits certain symptoms:

age  symptom1  symptom2
 50         0         1
 53         0         0
 70         1         1
  ...

I have started off by fitting simple models with forms like
  Prob(patient of age t shows symptom i) = 1 - Exp(-lambda_i * t)
or
  Prob(patient of age t shows symptom i) = 1 - A_i * Exp(-lambda_i * t)

Now, I want to plot my functional forms against the data, to get a rough
idea of how they look. If I do something simple like

  xyplot(symptom1 ~ age)

I get the data points, but it's hard to see what's going on. So I tried to
generate a smooth curve:

  xyplot(symptom1 ~ age,
    panel=function(x,y,...) {
      panel.xyplot(x,y,...)
      panel.loess(x,y,span=.75,...)
      })

This does generate a smooth curve which looks as if it's roughly in the
right place. But I feel uneasy about using a procedure I don't understand,
and I don't understand enough about loess to know if it's appropriate.

Is loess suitable for dealing with this sort of Bernoulli data? Is there a
different smoothing function which it would be "correct" for me to use?
Does anyone have recommendations about good ways to visualise this sort of
data?

Damon Wischik.




More information about the R-help mailing list