Hello,

Right!
I copied from the OP's question without thinking about it.
Corrected would be


bootMedianSE <- function(data, indices){
    d <- data[indices, ]
    fit <- rq(crp ~ bmi + glucose, tau = 0.5, data = d)
    ypred <- predict(fit)
    y <- d$crp
    median((y - ypred)^2)
}

Sorry,

rui Barradas

On 5/22/2018 11:32 AM, Daniel Nordlund wrote:
On 5/22/2018 2:32 AM, Rui Barradas wrote:
bootMedianSE <- function(data, indices){
      d <- data[indices, ]
      fit <- rq(crp ~ bmi + glucose, tau = 0.5, data = d)
      ypred <- predict(fit)
      y <- d$crp
      median(y - ypred)^2
}

since the OP is looking for the "median squared error", shouldn't the final line of the function be

         median((y - ypred)^2)


Dan


______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to