Let us worry about your assignment instead!

We Helped With This R Language Programming Homework: Have A Similar One?

SubjectR | R Studio
More InfoI Need Help With Statistics

Assignment Description

Problem 1. (Subsampling) This is a variant of the bootstrap where the sampling is without replacement. We look at this variant in the context of building a confidence interval for the mean θ of a distribution F on the real line. Consider an iid sample X1, . . . , Xn from that distribution. The process is based on a choice of two positive integers r and B, where r/n is typically small and B is large. Let 1 α denote the desired confidence level.

1) For b = 1, . . . , B:

a) Draw without replacement r observations from the sample, obtaining X1b , . . . , Xrb .

b) Compute the corresponding sample mean Xb¯ and sample standard deviation Sb, and form the t-ratio Tb = (Xb¯ X¯)/(Sb/ √r).

2) Let tγ denote the γ-quantile of {T1, . . . , TB} and return the interval

[ t1α/2 S/√r, X¯ tα/2 S/ r ]

(Above, and S denote the sample mean and sample standard deviation of X1, . . . , Xn.)

A. Write a function subsample.mean.CI(x, conf = 0.95, sub = length(x)/10, B = 999) that takes in the sample in the form of a numerical vector x, the desired confidence level conf, the subsample size sub (corresponding to r above), and the number of bootstrap replicates B, and returns the interval as computed above.

B. Generate a sample of size n {1000, 2000, . . . , 10000} from the standard normal distribution. Compute the subsampling confidence intervals corresponding to subsample sizes r {n/50, n/20, n/10, n/5, n/2}. Also, compute the bootstrap confidence interval (use the code from the solution to Homework 3). For each of these six confidence intervals, record whether it covers the population mean (1 if yes, 0 if not) and its length. Repeat the whole thing M = 1000 times. First, plot the coverage (averaged over the repeats) as a function of the sample size n. Then plot the length in a similar way. (Each of these two plots will have six curves.) Make the plots nice, with different colors identified in a legend for the different confident intervals. Offer some brief comments.




Problem 2. (Goodness-of-fit testing in multiple samples) Suppose we have multiple numerical samples. Let Yij denote the ith observation in group j, where i = 1, . . . , nj and j = 1, . . . , J. We want to test the null hypothesis that the samples come from the same distribution.

A. Write a function permSST(y, g, B = 999) which takes in the observations as a numerical vector y of size n1 + · · · + nJ and the corresponding group labels as a vector g taking values in {1, . . . , J}, and also the number of repeats B, and returns the Monte Carlo permutation p-value for the treatment sum of squares. [You may want to write a function to compute that sum, so that the code is cleaner.]

B. Consider the situation where we have J groups of same size n1 = · · · = nJ = m. The jth sample is drawn from the normal distribution with mean θj and variance 1. As an alternative, choose θj = jτ , where τ > 0. (The larger τ is, the farther the alternative is from the null.) Record the p-value corresponding to the ANOVA F-test (the one that assumes equal variances) and record the p-value returned by your permSST function. Do this for J {2, 5, 10}, m {10, 30, 100}, and five carefully chosen values of τ, and repeat each setting M = 200 times. In the same plot, for each of the two tests, graph the p-value (averaged over the M repeats) as a function of τ. (Thus you will end up generating 3 × 3 = 9 such plots in total.) The range of τ should be such that the average p-values are clearly seen to change with τ. Offer some brief comments.


Frequently Asked Questions

Is it free to get my assignment evaluated?

Yes. No hidden fees. You pay for the solution only, and all the explanations about how to run it are included in the price. It takes up to 24 hours to get a quote from an expert. In some cases, we can help you faster if an expert is available, but you should always order in advance to avoid the risks. You can place a new order here.

How much does it cost?

The cost depends on many factors: how far away the deadline is, how hard/big the task is, if it is code only or a report, etc. We try to give rough estimates here, but it is just for orientation (in USD):

Regular homework$20 - $150
Advanced homework$100 - $300
Group project or a report$200 - $500
Mid-term or final project$200 - $800
Live exam help$100 - $300
Full thesis$1000 - $3000

How do I pay?

Credit card or PayPal. You don't need to create/have a Payal account in order to pay by a credit card. Paypal offers you "buyer's protection" in case of any issues.

Why do I need to pay in advance?

We have no way to request money after we send you the solution. PayPal works as a middleman, which protects you in case of any disputes, so you should feel safe paying using PayPal.

Do you do essays?

No, unless it is a data analysis essay or report. This is because essays are very personal and it is easy to see when they are written by another person. This is not the case with math and programming.

Why there are no discounts?

It is because we don't want to lie - in such services no discount can be set in advance because we set the price knowing that there is a discount. For example, if we wanted to ask for $100, we could tell that the price is $200 and because you are special, we can do a 50% discount. It is the way all scam websites operate. We set honest prices instead, so there is no need for fake discounts.

Do you do live tutoring?

No, it is simply not how we operate. How often do you meet a great programmer who is also a great speaker? Rarely. It is why we encourage our experts to write down explanations instead of having a live call. It is often enough to get you started - analyzing and running the solutions is a big part of learning.

What happens if I am not satisfied with the solution?

Another expert will review the task, and if your claim is reasonable - we refund the payment and often block the freelancer from our platform. Because we are so harsh with our experts - the ones working with us are very trustworthy to deliver high-quality assignment solutions on time.

Customer Feedback

"Thanks for explanations after the assignment was already completed... Emily is such a nice tutor! "

Order #13073

Find Us On

soc fb soc insta

Paypal supported