Question

I have the following R code n <- 10 samples_0 <- 5 x <- 25 samples...

I have the following R code

n <- 10
samples_0 <- 5
x <- 25


samples <- matrix(c(runif(n*samples_0, 0, x)), ncol=n)
theta1 <- ((n + 1) / n) * samples
theta2 <- (n + 1) * samples
var(theta1)
var(theta2)

If the code above was run on an infinitely large samples_0, what would the values of the variance of theta1 (var(theta1) in code) and theta2 (var(theta2)) be to 11 decimal places?

Homework Answers

Answer #1

rm(list=ls())
n <- 10
samples_0 <- 10000000
for(i in 1:samples_0){
x <- 25
samples <- matrix(c(runif(n*samples_0[i], 0, x)), ncol=n)
theta1 <- ((n + 1) / n) * samples
theta2 <- (n + 1) * samples
}
var(theta1)
var(theta2)
plot(theta2)

#Here we see that our data is uniformally distributed,so if we increase the sample size it convert a dence form of recangle.it tends to normal distribution.

OUTPUT:-

> var(theta1)
[,1] [,2] [,3] [,4] [,5]
[1,] 63.030224952 -0.0168437722 3.317596e-02 -0.0353162309 2.154431e-02
[2,] -0.016843772 63.0099845011 -1.803850e-02 0.0213997798 -2.060295e-02
[3,] 0.033175959 -0.0180384991 6.301845e+01 0.0021669905 -7.070155e-05
[4,] -0.035316231 0.0213997798 2.166991e-03 63.0000416055 2.392772e-02
[5,] 0.021544315 -0.0206029495 -7.070155e-05 0.0239277242 6.301258e+01
[6,] -0.013296808 -0.0009509087 5.446718e-03 0.0122691572 -1.118176e-04
[7,] 0.016381570 -0.0077938267 8.969020e-03 0.0348942978 -2.724619e-02
[8,] -0.019554125 -0.0093099748 -2.677580e-03 -0.0042883917 6.177605e-04
[9,] -0.007973789 0.0235519094 1.315681e-02 0.0006755162 1.490616e-02
[10,] 0.008881979 -0.0240627816 -3.823215e-03 0.0282431352 2.409941e-03
[,6] [,7] [,8] [,9] [,10]
[1,] -0.0132968080 0.016381570 -0.0195541247 -0.0079737893 0.008881979
[2,] -0.0009509087 -0.007793827 -0.0093099748 0.0235519094 -0.024062782
[3,] 0.0054467184 0.008969020 -0.0026775801 0.0131568122 -0.003823215
[4,] 0.0122691572 0.034894298 -0.0042883917 0.0006755162 0.028243135
[5,] -0.0001118176 -0.027246187 0.0006177605 0.0149061591 0.002409941
[6,] 63.0232211003 0.039798149 -0.0066579803 0.0169614369 -0.002302151
[7,] 0.0397981487 63.022145390 0.0013889206 0.0065857189 0.008577477
[8,] -0.0066579803 0.001388921 63.0160685323 -0.0294366807 0.006110090
[9,] 0.0169614369 0.006585719 -0.0294366807 63.0150500016 -0.017090139
[10,] -0.0023021514 0.008577477 0.0061100904 -0.0170901385 63.026330909

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
Write an R code that does the following: (a) Generate n samples x from a random...
Write an R code that does the following: (a) Generate n samples x from a random variable X that has a uniform density on [0,3]. Now generate samples of Y using the equation: y = α/(x + β). For starters, set α = 1, β = 1 The R code: x=runif(n=1000, min = 0, max = 3) x y=1/x+1 y Please answer the following: b) Use plot(x,y) to check if you got the right curve. c) How does the correlation...
The following data is X-Bar and R values for 12 samples of size n = 5....
The following data is X-Bar and R values for 12 samples of size n = 5. They were taken from a process measuring various inductance values for a new production line of high fidelity speakers. Subgroup No., (X-Bar), ((Range)) 1 (345) ((13)), 2 (347) ((14)), 3 (350) ((12)), 4 (346) ((11)), 5 (350) ((15)), 6 (345) ((16)), 7 (349)((14)), 8 (348) ((13)), 9 (348)((12)), 10 (354) ((15)), 11 (352) ((13)), 12 (355) ((16)) Create X-Bar and R control charts from...
Can i make conclusions about m x n matrix with rank r with (n-r) values and...
Can i make conclusions about m x n matrix with rank r with (n-r) values and it's solution number? Is there any other relations between rank of a matrix and avalaible solutions?
5) R Code: Overlap a histogram of 10000 random values from Z ∼ N(0,1) with the...
5) R Code: Overlap a histogram of 10000 random values from Z ∼ N(0,1) with the histogram below. Include your code X = hist(replicate(10000, (mean(rbinom(50, 1, 0.1))))
Problem 10-25 Resistors for electronic circuits are manufactured on a high-speed automated machine. The machine is...
Problem 10-25 Resistors for electronic circuits are manufactured on a high-speed automated machine. The machine is set up to produce a large run of resistors of 1,000 ohms each. Use Exhibit 10.13.      To set up the machine and to create a control chart to be used throughout the run, 15 samples were taken with four resistors in each sample. The complete list of samples and their measured values are as follows: Use three-sigma control limits. SAMPLE NUMBER READINGS (IN OHMS)...
Below are X-bar and R values for 12 samples of size = 5. They are taken...
Below are X-bar and R values for 12 samples of size = 5. They are taken from a process producing bearings. The measurements are made on the inside diameter of the bearing. The data have been coded from 0.50; in other words, a measurement of 0.50345 has been recorded as 345. Range values are coded from 0.000; that is, 0.00013 is recorded as 13. Subgroup Number X-bar Range 1 145 13 2 147 14 3 150 12 4 146 11...
1. X ~ N(60, 11). Suppose that you form random samples of 25 from this distribution....
1. X ~ N(60, 11). Suppose that you form random samples of 25 from this distribution. Let X be the random variable of averages. Let ΣX be the random variable of sums. Find the 30th percentile. (Round your answer to two decimal places.) 2. X ~ N(50, 12). Suppose that you form random samples of 25 from this distribution. Let X be the random variable of averages. Let ΣX be the random variable of sums. Sketch the graph, shade the...
Given the following: n = 10 samples, X = 0.30 inches and the process range of...
Given the following: n = 10 samples, X = 0.30 inches and the process range of R = 0.0025 inches. What are the control limits of the X - chart and R - chart? Please show specific with the step by step.
I need this coded in R: I have a program that simulates a fair dice. The...
I need this coded in R: I have a program that simulates a fair dice. The program rolls a fair coin 100 times and counts the number of 1's. The simulation is repeated 10^5 times and stored the outcomes in x and a histogram is plotted. I need to now draw a bell curve showing normal/gaussian distribution over the histogram. Code I have: dice <- function(n) { sample(c(1:6),n,replace = TRUE) } x<-dice(100) x<-numeric(10^5) for(n in 1:10^5){ x[n]<-sum(dice(100)==1) } hist(x, main="100...
T: R^3 ----> R^5 such that T(x), then... a. A^-1 is 3x 5 matrix b. the...
T: R^3 ----> R^5 such that T(x), then... a. A^-1 is 3x 5 matrix b. the mapping cannot be onto c. the set of solutions to Ax=0 is infinite d. A has at least 2 free variables e. none of the above
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT