Question

Need help with R coding x <- matrix(rnorm(2000, 20, 5),nrow=100) xbar20 <- rowMeans(x) UL <- xbar20+qnorm(.90)*5/sqrt(20)...

Need help with R coding

x <- matrix(rnorm(2000, 20, 5),nrow=100)
xbar20 <- rowMeans(x)
UL <- xbar20+qnorm(.90)*5/sqrt(20)
LL <- xbar20-qnorm(.90)*5/sqrt(20)
cover<-sum(UL>20 & LL<20)/100

this code finds coverage for an 80% confidence interval, change the code for a 90 and 95% confidence interval

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

for 90% run the code

x <- matrix(rnorm(2000, 20, 5),nrow=100)
xbar20 <- rowMeans(x)
UL <- xbar20+qnorm(.95)*5/sqrt(20)
LL <- xbar20-qnorm(.95)*5/sqrt(20)
cover<-sum(UL>20 & LL<20)/100

for 95% confidence interval,

x <- matrix(rnorm(2000, 20, 5),nrow=100)
xbar20 <- rowMeans(x)
UL <- xbar20+qnorm(.975)*5/sqrt(20)
LL <- xbar20-qnorm(.975)*5/sqrt(20)
cover<-sum(UL>20 & LL<20)/100

Add a comment
Know the answer?
Add Answer to:
Need help with R coding x <- matrix(rnorm(2000, 20, 5),nrow=100) xbar20 <- rowMeans(x) UL <- xbar20+qnorm(.90)*5/sqrt(20)...
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
  • Need help with R coding x <- matrix(rnorm(2000, 20, 5),nrow=100) xbar20 <- rowMeans(x) UL <- xbar20+qnorm(.90)*5/sqrt(20)...

    Need help with R coding x <- matrix(rnorm(2000, 20, 5),nrow=100) xbar20 <- rowMeans(x) UL <- xbar20+qnorm(.90)*5/sqrt(20) LL <- xbar20-qnorm(.90)*5/sqrt(20) cover<-sum(UL>20 & LL<20)/100 this code finds coverage for an 80% confidence interval change code to use beta distribution with ( shape1=5, shape2=1). theoretical parameter values are: ? = 0.83, ? = 0.14

  • 100 96 24 2000 = 100 18 90 88 95 84 1966 1967 1968 1969 1990...

    100 96 24 2000 = 100 18 90 88 95 84 1966 1967 1968 1969 1990 1991 1992 1993 1994 1995 196 197 198 1999 2000 2001 2002 2003 2004 2005 2005 Year Source: Statistics Canada's Internet Site, http://estat.statcan.ca/cgi-win/cnsmcgi.exe, CANSIM table 387-000 V28546044, December 16, 2007. a. By approximately how many index points did the CPI change from 1990 to 2003? b. Express this change as a percent to the nearest hundredth. Is this change an increase or decrease in...

  • 1. A random sample of n measurements was selected from a population with standard deviation σ=13.6...

    1. A random sample of n measurements was selected from a population with standard deviation σ=13.6 and unknown mean μ. Calculate a 90 % confidence interval for μ for each of the following situations: (a) n=45, x¯¯¯=89.8 ≤μ≤ (b) n=70, x¯¯¯=89.8 ≤μ≤ (c) n=100, x¯¯¯=89.8 ≤μ≤ (d) In general, we can say that for the same confidence level, increasing the sample size the margin of error (width) of the confidence interval. (Enter: ''DECREASES'', ''DOES NOT CHANGE'' or ''INCREASES'', without the...

  • need help calculating 100% and 105% please! Kb of Ammonia = 1.8 x 10^-5 Thank you...

    need help calculating 100% and 105% please! Kb of Ammonia = 1.8 x 10^-5 Thank you pH Titration Curve A 40.0 mL sample of a 0.30 M solution of NH, is titrated with a 0.50 M HCl solution. Calculate the pH of the solution when the following percentages of the HCl solution required to reach the equivalence point have been added. Plot the data you determined for the pH at various points in the titration. o What is the pH...

  • Why is my multiplication wrong when i do a matrix of 3 x 5 and 2...

    Why is my multiplication wrong when i do a matrix of 3 x 5 and 2 x 2? code below import java.util.*; public class matrix { public static void main(String[] args) { int m, n, i, j; Random rand = new Random(); Scanner scan = new Scanner(System.in); System.out.print("enter how many rows:"); m = scan.nextInt(); System.out.print("enter how many columns:"); n=scan.nextInt(); int matrix_1[][] = new int[m][n]; //Initialize matrixes int maritx_2[][] = new int[m][n]; int matrix_add[][] = new int[m][n]; int matrix_mul[][] = new...

  • Already posted and got parts 1-4. Need the test of the questions please!! 5) Iran an...

    Already posted and got parts 1-4. Need the test of the questions please!! 5) Iran an ANOVA for this test. When I printed out the Word Doc in Google Docs, it eliminated a few of the values I highlighted in the ANOVA table. Use your knowledge of the ANOVA table and fill in the blanks. In this test, there are 5 groups and each group consist of 20 samples (100 total). df MS ANOVA Source of Variation Between Groups Within...

  • 1. A section of the printout for a multiple regression model attempting to predict results in an ...

    1. A section of the printout for a multiple regression model attempting to predict results in an RMIT maths subject is shown below. The variables ATAR score, MathsReady test score, attendance at SLC Drop-in and hours of study per week were considered. The 95% confidence interval for the intercept is [1.24, 18.22] or 1.24 - 18.22. A variable is considered a significant predictor if the 95% confidence interval does not contain zero. Which of the variables ‘ATAR score’, ‘MathsReady test...

  • a.   Find the FV of $1,000 invested to earn 10% annually 5 years from now. Answer...

    a.   Find the FV of $1,000 invested to earn 10% annually 5 years from now. Answer this question by using a math formula and also by using the Excel function wizard. Inputs: PV = 1000 I/YR = 10% N = 5 Formula: FV = PV(1+I)^N = Wizard (FV): $1,610.51 Note: When you use the wizard and fill in the menu items, the result is the formula you see on the formula line if you click on cell E12. Put the...

  • photos for each question are all in a row (1 point) In the following questions, use...

    photos for each question are all in a row (1 point) In the following questions, use the normal distribution to find a confidence interval for a difference in proportions pu - P2 given the relevant sample results. Give the best point estimate for p. - P2, the margin of error, and the confidence interval. Assume the results come from random samples. Give your answers to 4 decimal places. 300. Use 1. A 80% interval for pı - P2 given that...

  • CASE 1-5 Financial Statement Ratio Computation Refer to Campbell Soup Company's financial Campbell Soup statements in...

    CASE 1-5 Financial Statement Ratio Computation Refer to Campbell Soup Company's financial Campbell Soup statements in Appendix A. Required: Compute the following ratios for Year 11. Liquidity ratios: Asset utilization ratios:* a. Current ratio n. Cash turnover b. Acid-test ratio 0. Accounts receivable turnover c. Days to sell inventory p. Inventory turnover d. Collection period 4. Working capital turnover Capital structure and solvency ratios: 1. Fixed assets turnover e. Total debt to total equity s. Total assets turnover f. Long-term...

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
ADVERTISEMENT