Assignment 7 1b

Assignment 7 1b

by Micaela Wiseman -
Number of replies: 1

Hi, I'm having issues with by non-parametric bootstrapping function. 

non.p.bootstrap <- function(vector, n) {

mode.stat <- function(my.data,i) return(my.mode(my.data[i]))

b <- boot(data = vector, statistic = mode.stat, R = n)

return(b)

}

When I run the function I get the following error message:

Error in t.star[r, ] <- res[[r]] : 

  number of items to replace is not a multiple of replacement length


In reply to Micaela Wiseman

Re: Assignment 7 1b

by Erik Spence -
The error is caused by my my.mode function returning either 0 values or more than 1 value. Listen to the beginning of today's class recording.