Question

Write a code in R markdown Given sample data 1,2,3,2,2,2,6,0,2,3 (1) Estimate the percent bias of...

Write a code in R markdown

Given sample data 1,2,3,2,2,2,6,0,2,3

(1) Estimate the percent bias of the sample median as a fraction of the standard error.

(2) Find an appropriate 90% confidence interval for the true median and interpret.

(3) Estimate the probability that the sample median exceeds two, i.e., P(sample median > 2)

(4) Does the data provide sufficient/significant evidence that the mean exceeds 2?

Homework Answers

Answer #1

The R code for this problem is

getwd()
# the data is
#part 1
data=c(1,2,3,2,2,2,6,0,2,3)

#loading library boot
library(boot)

#settinga function that gives median
mymedian=function(x,d)
{median(x[d])}

#observed median
obs.median=median(data)
#calculation of SE of median
median.boot=boot(data,mymedian,R=10000)

#part 2
median.boot
# confidence interval of median
boot.ci(median.boot,conf = .9)

#part 3
s=sample(data,100000,replace = T)
length(s[s>2])/100000
#get answer as 0.29967

# part 4
ttest=function(x,d)
{sam=x[d]
t=(mean(sam)-2)*sqrt(length(sam)/var(sam))}
ttest=boot(data,ttest,R=10000)
#here t-statistic value is 0.60541
#hence we can say that the true mean is 2

Know the answer?
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
Similar Questions
3. Use R Studio: Include R Code A commuter records 20 commute times to gage her...
3. Use R Studio: Include R Code A commuter records 20 commute times to gage her median commute time. The data has a sample median of 24 and is summarized in this stem-and-leaf diagram: stem(commutes) 2 | 111233444444 2 | 55569 3 | 113 If the data is appropriate for t.test, use that to compute a 90% confidence interval for the median. Otherwise use wilcox.test (perhaps after a transform) to compute a confidence interval for the median.
From your data, what is the point estimate, p̂ of the population proportion? Write down the...
From your data, what is the point estimate, p̂ of the population proportion? Write down the confidence interval that you obtained. Interpret the result. What is the margin of error? Using the same data, construct a 98% confidence interval for the population proportion. Then, answer the following three questions: (i) What happens to the length of the interval as the confidence level is increased? (ii) How has the margin of error changed? (iii) If the sample size is increased, what...
In this word problem you will be given a sample of data from a normal population...
In this word problem you will be given a sample of data from a normal population along with a confidence level. It is your project to define what variable that sample data represents, and what the population is that your t-Interval will make an inference on. Given the following data, create your own word problem and answer the following questions. (1-6) Sample data: 1.3, 1.7, 1.7, 2.0, 2.3, 2.3, 2.7, 3.0, 3.0, 3.0, 3.3, 3.3, 3.7, 3.7, 4, 4 Confidence...
Use R statistical software to answer the following: A random sample of 172 women were given...
Use R statistical software to answer the following: A random sample of 172 women were given the flu vaccine while pregnant, and a control sample of 168 women were not given the vaccine. 2. The average birth weight for the vaccine group was 3.13 kg with a standard deviation of 0.53 kg. The average birth weight for the control group was 3.02 kg with a standard deviation of 0.45 kg. (a) Estimate the mean difference in birth weight μ1−μ2 for...
29. A study of 40 English composition professors showed that they spent, on average, 12.6 minutes...
29. A study of 40 English composition professors showed that they spent, on average, 12.6 minutes correcting a student’s term paper. The standard deviation was 2.6 min. a.Find and interpret the 90% confidence interval for the mean grading time of all composition papers. b. Does the confidence interval, at 90% confidence level, provide sufficient evidence that the mean time English composition professors spend on grading term papers exceeds 11 minutes? Write an appropriate inequality to justify your answer
Write a MATLAB code to read the following data sample of fluid properties. 1.       Read data...
Write a MATLAB code to read the following data sample of fluid properties. 1.       Read data from an input file to run the program. The format of the data file is given below. Format of input file # of components (integer) ????,1, ????,1 ,??1, ??1 (critical temperature (K), critical pressure (bar), acentric factor, mole fraction for component 1) [optional lines for additional component if the number of components is greater than 1, for components 2 up to 5] T (system...
Could you please solve these using r code. 1. A pumpkin farmer weighed a simple random...
Could you please solve these using r code. 1. A pumpkin farmer weighed a simple random sample of size n = 20 pumpkins, with these results: 9.6, 8.8, 5.1, 9.7, 9.1, 8.9, 8, 9.2, 2.7, 9.1, 8.5, 7.3, 9.3, 9.6, 4.1, 9.9, 7.6, 9, 7.2, 8.5 (a) Create a QQ plot of the weights. Do you think it is reasonable to assume that the population distribution is normal? Explain your answer. (b) Regardless of your answer to (a), use R...
Use the sample data and confidence level given below to complete parts (a) through (d). A...
Use the sample data and confidence level given below to complete parts (a) through (d). A research institute poll asked respondents if they acted to annoy a bad driver. In the poll, n = 2420 and x= 1043 who said they honked. Use a 90% confidence level. a. find the best point estimate of the population proportion p (round to 3 decimal places) b. identify the value of the margin of error E (round to 4 decimal places) c. construct...
30. The data represents a sample of the number of home fires started by candles for...
30. The data represents a sample of the number of home fires started by candles for the past 7 years in a certain city. 5460 5900 6090 6310 7160 8480 9930 (Check yourself: the sample mean is 7047 and sample standard deviation is 1616) a. Identify the variable in this set up b. Identify an individual in this set up c. Find and interpret the 99% confidence interval for the mean number of home fires started by candles each year,...
Given the data and output in the attached file, Construct a 90% confidence interval estimate for...
Given the data and output in the attached file, Construct a 90% confidence interval estimate for the average Sales when Advertising is 25 want a confidence interval. It uses Regressionquizoutput2. Regressionquizoutput1 Regression Statistics Multiple R R Square Adjusted R Square Standard Error N Observations 6 ANOVA df SS MS Regression 1 0.607903685 0.607903685 Residual 4 0.020846315 0.005211579 Total 5 0.62875 Coefficients Standard Error Intercept 1.799069984 0.153403661 GMAT 0.002912113 0.000269635 A graduate school wants to try to predict GPA based on...