 # ## Question 1: Robustness to Symmetric Non-Normality Examine the...

## Question

## Question 1: Robustness to Symmetric Non-Normality

Examine the type 1 error rate for 4 samples drawn from a default uniform distribution at sample sizes 5, 10, 20, 40. Please remember to assign the output to your own version of the data frame. You are welcome to write more efficient code, provided it achieves the same effect. The commented lines illustrate one possibility for saving results into your data frame.

```{r}
n<-5
K<-4
class<-rep(letters[1:K],each=n)
reject<-function(n,K,class,a){
# your code here
}

# sim.durso\$unif.5<-mean(replicate(5000,reject(5,K,class,.05)))
# n<-10
# class<-rep(letters[1:K],each=n)
# sim.durso\$unif.10<-mean(replicate(5000,reject(n,K,class,.05)))
# n<-20
# class<-rep(letters[1:K],each=n)
# sim.durso\$unif.20<-mean(replicate(5000,reject(n,K,class,.05)))
# n<-40
# class<-rep(letters[1:K],each=n)
# sim.durso\$unif.40<-mean(replicate(5000,reject(n,K,class,.05)))

```

## Question 2: Robustness to Asymmetric Non-Normality

Examine the type 1 error rate for 4 samples drawn from a Gamma(1,2) distribution at sample sizes 5, 10, 20, and 40. The R interface for the gamma distribution treats the first parameter as shape and the second as rate. We'll use this here: shape=1, rate=2. Please remember to assign the output to your own version of the data frame. You are welcome to write more efficient code

```{r}
n<-5
K<-4
class<-rep(letters[1:K],each=n)
reject<-function(n,K,class,a){
# your code here
}

# sim.durso\$gamma12.5<-mean(replicate(5000,reject(5,K,class,.05)))
# n<-10
# class<-rep(letters[1:K],each=n)
# sim.durso\$gamma12.10<-mean(replicate(5000,reject(n,K,class,.05)))
# n<-20
# class<-rep(letters[1:K],each=n)
# sim.durso\$gamma12.20<-mean(replicate(5000,reject(n,K,class,.05)))
# n<-40
# class<-rep(letters[1:K],each=n)
# sim.durso\$gamma12.40<-mean(replicate(5000,reject(n,K,class,.05)))

```

## Question 3: Robustness to Asymmetric Non-Normality, cont.

Examine the type 1 error rate for 4 samples drawn from a Gamma(2,2) distribution (shape=2, rate=2) at sample sizes 5, 10, 20, and 40. Please remember to assign the output to your own version of the data frame. You are welcome to write more efficient code.

```{r}
n<-5
K<-4
class<-rep(letters[1:K],each=n)
reject<-function(n,K,class,a){
# your code here
}

# sim.durso\$gamma22.5<-mean(replicate(5000,reject(5,K,class,.05)))
# n<-10
# class<-rep(letters[1:K],each=n)
# sim.durso\$gamma22.10<-mean(replicate(5000,reject(n,K,class,.05)))
# n<-20
# class<-rep(letters[1:K],each=n)
# sim.durso\$gamma22.20<-mean(replicate(5000,reject(n,K,class,.05)))
# n<-40
# class<-rep(letters[1:K],each=n)
# sim.durso\$gamma22.40<-mean(replicate(5000,reject(n,K,class,.05)))

```

## Question 4: Robustness to Unequal Variances

In this exercise, please set two of the groups to be Normally distributed with variance 1 and two to be Normally distributed with variance 2.

```{r}
n<-5

class<-rep(letters[1:4],each=n)
reject<-function(n,class,a){
# your code here
}

# sim.durso\$unequal.5<-mean(replicate(5000,reject(5,K,class,.05)))
# n<-10
# class<-rep(letters[1:K],each=n)
# sim.durso\$unequal.10<-mean(replicate(5000,reject(n,K,class,.05)))
# n<-20
# class<-rep(letters[1:K],each=n)
# sim.durso\$unequal.20<-mean(replicate(5000,reject(n,K,class,.05)))
# n<-40
# class<-rep(letters[1:K],each=n)
# sim.durso\$unequal.40<-mean(replicate(5000,reject(n,K,class,.05)))

```

## Question 5: Interpretation

Please save your data frame to the appropriate .csv file, and examine the data frame. What do you conclude about the effects on the type 1 error rate for the hypothesis violations simulated above? Please remember to compare the two Gamma simulations.

```{r}
write.csv(sim.durso,file="durso.csv")

## Question 6: ANOVA from summary data

The following data are from a study of effectiveness of vitamin D supplements for pregnant women. The details are available in the "Study Details" tab in https://clinicaltrials.gov/ct2/show/results/NCT00292591?term=race&recrs=e&rslt=With&cond=Pregnancy&rank=1§=X70156#outcome1

The outcome variable is circulating hydroxyvitamin D concentration. The following code creates a data frame in which the "treat" column identifies the dosage of cholecalciferol used, the "ct" variable gives the number of participants completing the study in the treatment, the "conc" column gives the mean hydroxyvitamin D concentration in nanograms per milliliter, and the "sd" column gives the sample standard deviation of the "conc" within the treatment. Please use this information to conduct an ANOVA test of the equality of the means of the groups. Please comment on the extent to which the hypotheses of the ANOVA are satisfied, and the interpretation of the results if the hypotheses are satisfied. (10 points)

```{r}
treat<-c("iu400","iu2000","iu4000")
ct<-c(102,111,110)
conc<-c(32.5,41.0,45.7)
sd<-c(14.4,14.6,14.3)
dat<-data.frame(treat,ct,conc,sd)

```

## Solution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

By purchasing this solution you'll be able to access the following files:
Solution1.pdf and Solution2.zip.

\$50.00
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

### Find A Tutor

View available Statistics-R Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.