Displaying 2 results from an estimated 2 matches for "theta_star".
2010 Apr 30
3
apply question
Hello,
I have a bootstrap implementation loop that I would like to replace by a faster "batch operator".
The loop is as follows:
for (b in 1:B) {
indices <- sample(1:N, size=N, replace=TRUE) # sample n elements with replacement
theta_star[b,] = statistic(data,indices) # execute statistic callback function
}
I would like to replace this by something like (does not work):
indices <- replicate(B,sample(1:N, size=N, replace=TRUE))
theta_star <- apply(indices,2,statistic,data)
This, however, does not work because the statist...
2010 May 01
0
bootstrap generalization error
...zation
## error. The formula for the bootstrap generalization error is:
## $N^{-1}\sum_{i=1}^n B^{-1}\sum_{j=1}^B |y_i - (\beta_n^{*j})^T x|$
##
## x - mxn matrix where m is the number of model parameters and n is the
## number of observations
## y - n column-vector containing true values
## theta_star - mxn matrix where m is the number of bootstrapped samples
## and n is the number of model parameters
##
bootstrapge <- function(x,y,theta_star) {
B <- nrow(theta_star)
P <- ncol(theta_star)
t <- 0
for (b in 1:B) {
t <- t + abs(y - rbind(theta_star[b,])%*%x)
}...