在百分位回归中计算高于百分位数的值

时间:2012-10-14 12:39:04

标签: r regression

我试图弄清楚如何在百分位回归中计算超过某个百分位数的值。 我使用参考值使用包lmsqreg创建一个百分位回归,然后我在顶部绘制实验值。 例如


#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百分位之上。类似的东西可能已在其他地方得到解答,但由于我不熟悉这个领域的命名法,我不确定我应该搜索什么。

提前致谢,

洛拉

0 个答案:

没有答案