我试图弄清楚如何在百分位回归中计算某个百分位以上的值。我使用参考值来创建使用包 lmqreg 的百分位回归,然后我将实验值绘制在顶部。例如。
#reference data
male.weight <- lmsqreg.fit(log(males$heart),
log(males$weight),
pvec = (centiles <- c(0.03, 0.1, 0.5, 0.9, 0.97)),
lam.fixed=1)
plot(log(males$weight),log(males$heart),
axes=FALSE,
frame.plot=TRUE,
xlab="Weight (kg)",
ylab="Heart weight (g)",
main="Men",
col = "white",
xlim = c(3.2,5.2),
ylim = c(4.7, 7))
axis(1,at=log(xat <- c(3,5,7,9,11,13,15,17,19)*10),
labels=xat)
axis(2,at=log(yat <- (1.5:10)*100),labels=yat)
lpars <- list(lty=rep(c(2,1,2),
c(2,1,2)),
col=c("#444444","#999999","#000000")
[c(1,2,3,2,1)])
for(l in 1:nrow(male.weight$qsys$outmat) ){
lines(male.weight$qsys$targetx,
male.weight$qsys$outmat[l,],
lty=lpars$lty[l],col=lpars$col[l])
}
#experimental data
points(log(m.heart$weight[m.heart$cod.g == "nCA"]),
log(m.heart$heart.w[m.heart$cod.g == "nCA"]),
pch = 21, col = "black")
points(log(m.heart$weight[m.heart$cod.g == "CA"]),
log(m.heart$heart.w[m.heart$cod.g == "CA"]),
pch = "♥", col = "red")
我想知道的是m.heart$weight[m.heart$cod.g == "nCA"]
(实验数据)有多少百分比位于 0.9 和 0.97 百分位以上。其他地方可能已经回答了类似的问题,但由于我不熟悉该区域的命名法,我不确定我应该搜索什么。
提前致谢,
萝拉