search for: bootmedianse

Displaying 5 results from an estimated 5 matches for "bootmedianse".

2018 May 22
2
Bootstrap and average median squared error
...ake the results reproducible. Rui Barradas On 5/22/2018 10:00 AM, Rui Barradas wrote: > Hello, > > If you want to bootstrap a statistic, I suggest you use base package boot. > You would need the data in a data.frame, see how you 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 &...
2018 May 22
1
Bootstrap and average median squared error
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 B...
2018 May 22
0
Bootstrap and average median squared error
Hello, If you want to bootstrap a statistic, I suggest you use base package boot. You would need the data in a data.frame, see how you 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...
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
0
Bootstrap and average median squared error
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", s...