[R] Bootstrap and average median squared error

Daniel Nordlund djnord|und @end|ng |rom gm@||@com
Tue May 22 12:32:36 CEST 2018


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

-- 
Daniel Nordlund
Port Townsend, WA  USA




More information about the R-help mailing list