April 2022 CS1B Qu 2v

Discussion in 'CS1' started by User_111995, Sep 13, 2022.

  1. User_111995

    User_111995 Keen member

    Hi,
    In CS1B paper - April 2022 question 2v it asks you to "determine an estimate of the standard error of the sample mean using bootstrap with a bootstrap sample size of 10,000".

    When answering the question, using what we know about calculating the standard error from question iv) (Standard_error = sd(y)/sqrt(length(y)) I calculated the standard error using the following code:
    set.seed(12345)
    bm<-rep(0,10000)
    for (i in 1:10000)
    {bm<-sd(sample(y, length(y), replace=TRUE))/sqrt(length(y))}
    mean(bm)
    # 0.4264077

    However, in the examiners report they do the mean of the sample and then take the standard deviation like so:
    set.seed(12345)
    nsim = 10^4
    ybar.sim = numeric(nsim)
    for (i in 1:nsim){
    y.sim = sample(y, replace=T)
    ybar.sim = mean(y.sim)
    se.boot = sd(ybar.sim); se.boot
    # 0.4318923

    Is the standard deviation of the mean of a bootstrap sample the same as the standard error? I've tried googling and I've only found similar code to how I answered the question. Would someone please be able to explain how my code is not calculating the se?

    Thank you,
    Lily
     
  2. User_111995

    User_111995 Keen member

    I think I answered my own question and the standard error is the sampling statistic's standard deviation. Since we're bootstrapping the sampling mean we can just take the standard deviation of the sample mean.
     
  3. John Lee

    John Lee ActEd Tutor Staff Member

    The standard error of the estimator of the mean is the standard deviation of the estimator - hence they calculate the standard error of the bootstrap distribution of the means.

    However, whilst the standard error of each mean is equal to \(S/\sqrt{n}\) there is no reason why the mean of these should be equal to the standard deviation of the distribution of the means (though we'd certainly hope they'd be similar).

    So whilst the examiners awarded some marks for this approach, it did not receive full marks.
     
    User_111995 likes this.
  4. User_111995

    User_111995 Keen member

    Thank you again John for the help, this makes sense!
     
  5. John Lee

    John Lee ActEd Tutor Staff Member

    Glad I could help.
     

Share This Page