Question

In: Math

Before opening the dataset needed for this problem, you’ll need to call the “car” package: >...

Before opening the dataset needed for this problem, you’ll need to call the “car” package:

> library(car)

Now you can import the “Wong” dataset and use it to answer the question below.

Remember to include any code you use along with your answers in your submission!

3. The Wong dataset contains data from a study by Wong, Monette, and Weiner (2001) on patients who fell into comas after sustaining traumatic brain injuries. After waking, Wong and colleagues administered two different intelligence tests (the “piq” and “viq” variables). The “duration” variable indicates how long each patient was in a coma before waking (measured in days).
a. Consider that this dataset represents the population of all patients who fell into comasafter sustaining traumatic brain injuries. Calculate the population mean and standard deviation of the duration variable.

b. Simulate drawing 1,000 random samples of size n =30 and store the sample mean durations in a vector (see the Lab 4 handout and/or video). Create a histogram of your sampling distribution of means for duration.

c. Calculate the mean and standard deviation of your sampling distribution. How do they compare to the population mean and standard deviation?

d. If you decreased your sample size to n=10, how would the shape of your sampling distribution change compared to what you reported above?

Solutions

Expert Solution

The code for the following question is given below:

A.) Code:   

#calling the library
library(car)

set.seed(12)
#Loading the data
data<-Wong
data

#A.)selecting the "duration variable"
dur<-data$duration
dur

##Population mean and standard deviation

mean(dur)
sd(dur)

Output:

> mean(dur)
[1] 14.29607
> sd(dur)
[1] 26.03989

B.) Code:   

#B.) 1000 samples of size n=30

l<-list()
m<-c()
s<-c()
for(i in 1:1000){
l[[i]]<-sample(dur,30,replace = F)
m[i]<-mean(l[[i]])
s[i]<-sd(l[[i]])
}
#Creating histogram for sample mean
hist((m)

Output:   C.) Code:C.) Code:


#C.) Mean and standard deviation of sampling distribution

mean(m)
sd(m)

Output:   > mean(m)
[1] 14.32873
> sd(m)
[1] 4.494283

D.) Code: ##D.)Changing the sample size to 10
l1<-list()
m1<-c()
s1<-c()
for(i in 1:1000){
l1[[i]]<-sample(dur,10,replace = F)
m1[i]<-mean(l1[[i]])
s1[i]<-sd(l1[[i]])
}
#Creating histogram for sample mean
hist((m1))

Output:


Related Solutions

Use RStudio to answer this question. Before opening the dataset needed for this problem, you’ll need...
Use RStudio to answer this question. Before opening the dataset needed for this problem, you’ll need to call the “car” package > library(car) Now you can import the “Robey” dataset and use it to answer the question below. Name the data frame with abc: > abc <- Robey Remember to include any R code you use along with your answers! The Robey dataset contains fertility rates from a sample of countries. You want to see if total fertility rate (tfr),...
R work (must be done in R) Before opening the dataset needed for this problem, you’ll...
R work (must be done in R) Before opening the dataset needed for this problem, you’ll need to call the “car” package. Run the following line of code: > library(car)  Now you can import the “ Cowles” dataset and use it to answer the question below. Name the data frame with your EID: > my_eid <- Cowles Remember to include any code you use along with your answers in your submission! 3. Cowles and Davis (1987) collected data on...
To find the dataset needed for this problem, you’ll first need to open the “swiss” dataset...
To find the dataset needed for this problem, you’ll first need to open the “swiss” dataset that is contained in R by running the following line: > data('swiss') Now you can rename the “swiss” dataset and use it to answer the question below. Name the data frame with your UT EID:                         > my_variable <- swiss This dataset contains socio-economic indicators for the French-speaking provinces of Switzerland in the year 1888. Among the variables, “Agriculture” is the percentage of the...
I need this in R code please: Use the dataset ’juul’ in package ’ISwR’ to answer...
I need this in R code please: Use the dataset ’juul’ in package ’ISwR’ to answer the question. (1) Conduct one-way ANOVA test to test if the mean of igf1 of each level of tanner are the same? (2) What is the mean of igf1 in each level of tanner? (3) If there is any difference, which ones appear to be different? (Use pairwise t test for each pair of level with bonferroni method)
Imagine you’re thinking about buying a new car. Before making this important decision, you’ll want to...
Imagine you’re thinking about buying a new car. Before making this important decision, you’ll want to gather as much information as possible to help make the right choice. Determine the level of trust that you would place in information provided by the following sources: a salesman at the car lot, the dealer’s Website, social media (i.e. Facebook), an associate from work, and a close friend. Discuss the key factors involved in assessing the amount of trust that you put into...
Using the Motor Trend Car Road Tests dataset mtcars, in faraway R package, fit a model...
Using the Motor Trend Car Road Tests dataset mtcars, in faraway R package, fit a model with mpg: Miles/(US) gallon as the response and the other variables as predictors. (a) Which variables are statistically significant at the 5% level? For each and every test provide the null and alternative hypotheses, critical region (or rejection region), test statistics and your conclusions. (30) (b) What interpretation should be given to the coefficient for vs: Engine? (3) (c) Compute 90 and 95% confidence...
Problem-Solving Case: Training Call Center Employees The employees in a call center need to be able...
Problem-Solving Case: Training Call Center Employees The employees in a call center need to be able to speak to customers politely, but their skill set is more complicated than etiquette. They also need to handle a range of questions and problems about particular products. Whenever their company adds a new line of products or services, the employees have to be prepared to answer a new set of questions. Thus, training is an ongoing con- cern in call centers. The traditional...
1. For this problem you will need a t-table. What is the t-value needed for the...
1. For this problem you will need a t-table. What is the t-value needed for the critical value for a one-tailed upper hypothesis test with a sample size = 40 and alpha =.05? 2. For this problem it would be helpful to have a standard normal table. What is the z-value needed for a confidence interval of a proportion with a sample size of 600 and alpha equal to .10? 3. For this problem you will need a t-table. What...
Consult Interactive Solution 2.22 before beginning this problem. A car is traveling along a straight road...
Consult Interactive Solution 2.22 before beginning this problem. A car is traveling along a straight road at a velocity of +25.0 m/s when its engine cuts out. For the next 2.25 seconds, the car slows down, and its average acceleration is a1 . For the next 5.23 seconds, the car slows down further, and its average acceleration is a2. The velocity of the car at the end of the 7.48-second period is +16.5 m/s. The ratio of the average acceleration...
Quantitative Problem: You need $11,000 to purchase a used car. Your wealthy uncle is willing to...
Quantitative Problem: You need $11,000 to purchase a used car. Your wealthy uncle is willing to lend you the money as an amortized loan. He would like you to make annual payments for 4 years, with the first payment to be made one year from today. He requires a 9% annual return. What will be your annual loan payments? Do not round intermediate calculations. Round your answer to the nearest cent. $   How much of your first payment will be...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT