percentiles quantiles with brain data > brain = read.table(file="D:\\drr07\\stat141\\brain.dat", header = T) > attach(brain) > boxplot(brainwt ~ sex) # that "model statement" gives you side-by-side boxplots > > quantile(brainwt[sex == "f"]) # default quartiles 0% 25% 50% 75% 100% 937 1038 1096 1190 1392 > mean(brainwt[sex == "f"] < 1038) #get proportion corresponding to lower quartile [1] 0.2467532 > mean(brainwt[sex == "f"] < 1039) [1] 0.2597403 > mean(brainwt[sex == "f"] <= 1038) [1] 0.2597403 > # there is a 1038 value in fem brain (see lect 2) > # 25% data at or below 1038 in sample of 77 fem > quantile(brainwt[sex == "f"], .3) # find value 30% sample at or below 30% 1045 > mean(brainwt[sex == "f"] <= 1045) # here's corresponding proportion (percentile) [1] 0.3116883 > mean(brainwt[sex == "f"] < 1045) # here's corresponding proportion (percentile) [1] 0.2857143 > # discreteness of relatively small sample > quantile(brainwt[sex == "f"], .9) # find value 90% sample at or below 90% 1248.2 > mean(brainwt[sex == "f"] <= 1248.2) # here's corresponding proportion (percentile) [1] 0.8961039 >