Question

R Coding

Let A=column 1 in the dataset, B=column 2, C = column 3. We are interested in calculating the statistic mean(A) – mean (B) mean (B) – mean (C) Write a function (without using the R boot package) that takes in this dataset and then gets a bootstrap distribution for the dataset. Return the observed statistic and a vector of bootstrap statistics.

Bootstrap = function(dataset, num_boot)

{

}

Thank you!

0 0
Add a comment Improve this question Transcribed image text
Answer #1

xDataset B Desired number of bootstrap samples to tak boot.meanfunction (x, B,binwidth-NULL) n length(x) boot.samples matrixBootstrap distribution of he given dataset x(here)

Add a comment
Know the answer?
Add Answer to:
R Coding Let A=column 1 in the dataset, B=column 2, C = column 3. We are...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • a survey of 400 new managers revealed that only 39% of them had received management training....

    a survey of 400 new managers revealed that only 39% of them had received management training. let p represent the true proportion of new managers who receive management training. we want to generate a 90% confidence interval for the true proportion of managers who have received management training using a simulation method. in order to do this, we will use (a. bootstrap, b. Randomization). here is how we do it: 1. sample (a. with replacement, b. without replacement) from the...

  • Select the appropriate response a)The bootstrap assumes that data is normally distributed b)The bootstrap is applicable...

    Select the appropriate response a)The bootstrap assumes that data is normally distributed b)The bootstrap is applicable for any distribution of independently identically distributed random samples c)The bootstrap is applicable only to large samples Select the appropriate answer a)The bootstrap provides a procedure for estimating the uncertainty of parameter estimates b)The bootstrap provides a closed form formula for computing the uncertainty of any statistics c)The bootstrap provides an exact measure of uncertainty of distribution parameters Select the appropriate answer a)The bootstrap...

  • 2. The roots of the quadratic $a x^2 + b x + c$ are given by...

    2. The roots of the quadratic $a x^2 + b x + c$ are given by $$\frac{-b \pm \sqrt{b^2-4ac}}{2a}$$ If $b^2-4ac <0$, the quadratic has no real roots. Write a function to calculate the real roots of a quadratic. The function should have 3 arguments, *a*, *b* and *c*. If $b^2-4ac <0$, the function should print "quadratic has no real roots", and then return(NULL). Otherwise, the function should return a vector of length 2, those being the real roots (which...

  • 3. Let N = R and P be the probability distribution on (R, B(R)) with density...

    3. Let N = R and P be the probability distribution on (R, B(R)) with density 1 XER. Put X(w):=w2, WEN. (a) Describe o(X) (the o-algebra on 2 generated by X). Justify your answer. (b) Derive the distribution function Fx of the random variable X. (c) Compute the mean EX and moment generating function y(t) := t> 0, for the random variable (RV) X. [3+3+3=9] EetX 300,

  • 3. Let N = R and P be the probability distribution on (R, B(R)) with density...

    3. Let N = R and P be the probability distribution on (R, B(R)) with density 1 -131 XER. Put X(w):=w2, WEN. (a) Describe o(X) (the o-algebra on 2 generated by X). Justify your answer. (b) Derive the distribution function Fx of the random variable X. (c) Compute the mean EX and moment generating function y(t) == EetX 500, t> 0, for the random variable (RV) X. (3+3+3 = 9]

  • # 3. The following code draws a sample of size $n=30$ from a chi-square distribution with...

    # 3. The following code draws a sample of size $n=30$ from a chi-square distribution with 15 degrees of freedom, and then puts $B=200$ bootstrap samples into a matrix M. After that, the 'apply' function is used to calculate the median of each bootstrap sample, giving a bootstrap sample of 200 medians. "{r} set.seed (117888) data=rchisq(30,15) M=matrix(rep(0,30*200), byrow=T, ncol=30) for (i in 1:200 M[i,]=sample(data, 30, replace=T) bootstrapmedians=apply(M,1,median) (3a) Use the 'var' command to calculate the variance of the bootstrapped medians....

  • Using the R language: Suppose we have a vector, called longvector with 1000 elements. A. How...

    Using the R language: Suppose we have a vector, called longvector with 1000 elements. A. How would you let R calculate the mean value of longvector? Write the code here: B. What if there are some NA values and you'd like R to remove the NA values when calculating the mean of longvector? Write the code here: C. How would you plot a histogram to show the distribution of values in longvector? Write the code here: D. How would you...

  • 12. (True/False) (a) Let AE Rm*n . Then R(A) (b) Let AERm*n. Then N(A) is isomorphic to N(AT) (c) We define < A. B > = Tr (BTA ) where A, B E Rnxn . is isomorphic to R(A Then 〈 . , . 〉 is an...

    12. (True/False) (a) Let AE Rm*n . Then R(A) (b) Let AERm*n. Then N(A) is isomorphic to N(AT) (c) We define < A. B > = Tr (BTA ) where A, B E Rnxn . is isomorphic to R(A Then 〈 . , . 〉 is an inner product on Rmxn. (d) Consider a periodic-function space V with period of 1 sec. Define an inner product on V by <f,a>= f(t )a (t ) dt. Then cos 2 π t...

  • 6. We want to test whether there is an equal ratio of freshman to sophomores to...

    6. We want to test whether there is an equal ratio of freshman to sophomores to juniors to seniors at UC Davis. I perform a Goodness of Fittest and to reject the null hypothesis then a. the sample distribution was extremely uneven across dasses b. we conclude that the ratio in the null hypothesis is plausible c. we know the test statistic was larger than the critical value d. we know the degrees of freedom for the test was 7....

  • Problem 2 [2 4 6 81 Let A 1 3 0 5; L1 1 6 3 a) Find a basis for the nullspace of A b) Find the basis for the rowspace of A c) Find the basis for the range of A that consists of column vectors of...

    Problem 2 [2 4 6 81 Let A 1 3 0 5; L1 1 6 3 a) Find a basis for the nullspace of A b) Find the basis for the rowspace of A c) Find the basis for the range of A that consists of column vectors of A d) For each column vector which is not a basis vector that you obtained in c), express it as a linear combination of the basis vectors for the range of...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT