r - Quantile regression split plots -
i have few years of daily rainfall data particular region. insight of extreme rainfall events,i used quantile regression (quantreg package) in r. plot entire days shown below. want split regression line in middle (or other point) , fit first , second half of data separately see difference.
here how used quantreg:
plot(data$ahmann~data$days, type="p", pch=20,cex=.4, col="gray50", xlab="days", ylab="rainfall") qr <- abline(rq(data$ahmann~data$days,tau=.99),col="red")
if want run quantreg::rq
on different sets of data, replace
data$ahmann~data$days
with
x <- 10 stopifnot(x <= nrow(data)) set1 <- data[1:x,] abline(rq(set1$ahmann~set1$days,tau=.99),col="red") set2 <- data[x:nrow(data),] abline(rq(set2$ahmann~set2$days,tau=.99),col="red")
Comments
Post a Comment