3
$\begingroup$

I have a scatter plot of (for example) height against age. How does one calculate for an individual point the percentile of the height for a given age?

Suggestions in R would be most appreciated. Thanks!

$\endgroup$
3
$\begingroup$

The dataset would have to be enormous for the empirical approaches to have sufficient precision, and it doesn't help very much to look at percentiles of the marginal distribution of height. I suggest quantile regression, allowing age to be flexibly modeled (e.g., using restricted cubic splines). Here is an example using R.

require(rms)  # loads quantreg, Hmisc, SparseM packages too
dd <- datadist(mydata); options(datadist='dd')
f <- Rq(ht ~ rcs(age,5), tau=.25, data=mydata) # model 25th percentile
f
plot(Predict(f))  # shows confidence bands 
nomogram(f) # make a nomogram to predict the quantile manually
$\endgroup$
  • $\begingroup$ Aha - it's Rq not Qr() [I think]. Works brilliantly! Upvote from me. $\endgroup$ – Andrew May 12 '11 at 15:19
  • $\begingroup$ Sorry that should have been Rq. I'll correct the above. $\endgroup$ – Frank Harrell May 12 '11 at 21:09
1
$\begingroup$

'The' percentile for a given age implies some sort of regression (i.e. you can find 'the' mean predicted height from a given age).

Once you have found this, the result depends on your assumptions: if you want no assumptions (besides the regression's), find how many of the heights in your original data are smaller than the predicted one for your age (=use empirical distribution).

Otherwise, you can fit whatever model you like to the marginal distribution of height and then find the percentile of the predicted height in that distribution.

$\endgroup$
  • $\begingroup$ With a sufficient size of data set, a model isn't needed. Take all the people of a given age (say, 8 years old) and take the percentile within that group. You might find the 30th percentile is .8 meters, the 60th percentile is 1.2 meters, etc. $\endgroup$ – zbicyclist May 11 '11 at 15:02
  • $\begingroup$ @ Nick & @Sabbe Thanks - we'd have to collect a lot more data though, so I don't think this would work. I should have said this in the question - apologies. $\endgroup$ – Andrew May 13 '11 at 13:23
  • $\begingroup$ Smooth modeling (e.g., using quantile regression) requires a much lower sample size than required by binning the data. However the sample sizes needed are not trivial. $\endgroup$ – Frank Harrell May 16 '11 at 15:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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