Monday, April 20, 2020

quantile

A measure of spread. Use quantile to get the percentile of an observation variable.

You will always need the x (the data.frame) and probs (list of percentiles you want) arguments. You will use this frequently when you want to determine an observation's position in the ordered distribution.

R Example

This example, which I found on r-tutor, extracts the 32nd, 57th, and 98th percentiles for eruption duration in the faithful dataset.

> duration = faithful$eruptions     # the eruption durations 
> quantile(duration, c(.32, .57, .98)) 

   32%    57%    98% 

2.3952 4.1330 4.9330

No comments:

Post a Comment

Please help to combat malicious use of the Internet.