Displaying 3 results from an estimated 3 matches for "medse".
Did you mean:
meds
2018 May 22
0
Bootstrap and average median squared error
...ou could do it.
library(boot)
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
}
dat <- data.frame(crp, bmi, glucose)
nboot <- 100
medse <- boot(dat, bootMedianSE, R = nboot)
medse$t0
mean(medse$t) # This is the value you want
Hope this helps,
Rui Barradas
On 5/22/2018 12:19 AM, varin sacha via R-help wrote:
> Dear R-experts,
>
> I am trying to bootstrap (and average) the median squared error evaluation metric...
2018 May 21
2
Bootstrap and average median squared error
Dear R-experts,
I am trying to bootstrap (and average) the median squared error evaluation metric for a robust regression. I can't get it. What is going wrong ?
Here is the reproducible example.
#############################
install.packages( "quantreg" )
library(quantreg)
crp <-c(12,14,13,24,25,34,45,56,25,34,47,44,35,24,53,44,55,46,36,67)
bmi
2018 May 22
2
Bootstrap and average median squared error
...ction(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
> }
>
> dat <- data.frame(crp, bmi, glucose)
> nboot <- 100
>
> medse <- boot(dat, bootMedianSE, R = nboot)
>
> medse$t0
> mean(medse$t)??? # This is the value you want
>
>
> Hope this helps,
>
> Rui Barradas
>
>
>
> On 5/22/2018 12:19 AM, varin sacha via R-help wrote:
>> Dear R-experts,
>>
>> I am tryin...