Question

Using R programming language, complete the following.

1. Generate the bivariate normal sample of size 100 with
parameters

a. marginal mean of X equal to 1,

b. marginal mean of Y equal to 2,

c. marginal variance of X equal to 3,

d. marginal variance of Y equal to 4,

e. correlation between X and Y equal to -1/2.

You can use the function mvrnorm(), first installing its package by
the code

if (! require ("MASS")) install.packages("MASS"); library
("MASS")

2. Produce scatter plot.

3. Create histogram of a marginal distribution of X. You can use
the function hist()

4. Create qq plot (probability plot) of a marginal distribution of
X vs normal and comment on it. You can use the function
qqnorm().

5. Compute sample means and sample variances of X and Y marginal
distributions, and sample correlation between X and Y. You can use
the functions mean(), var(), cor().

Answer #1

3.

4.

As from QQ plot we can see that the points follow linear line so we can say that X and Y come from normal distribution.

(5) [1] 1.245655 [1] 2.053158 > var(X);var(Y) [1] 3.048119 [1] 3.305575 > cor(X,Y) [1] -0.09814289

The code that we used are below.

library(MASS)

mu=c(1,2)

Sigma=matrix(c(3,-.5,-.5,4),2,2)

xx=mvrnorm(n = 100, mu, Sigma, tol = 1e-6, empirical = FALSE,
EISPACK = FALSE)

X=xx[,1];Y=xx[,2]

plot(x,xlab = "X",ylab = "Y")

hist(X)

hist(Y)

qqnorm(X,main = "Normal QQ Plot of X")

qqnorm(Y,main = "Normal QQ Plot of Y")

mean(X);mean(Y)

var(X);var(Y)

cor(X,Y)

Use the programming language R to code the following
project..
* Make sure you turn in your code and answers from
each question. (not the raw data).
1. Generate 1000 random samples of size 40 from the normal
distribution with mean µ = 3 and
standard deviation σ = 2. Compute 95% the confidence interval of
1000 samples and find the rate
of confidence interval contains the true mean. What did you learn
from this simulation study?
2. For each...

USING MATLAB
(A) Use the rand command to generate “X” of size [10000 1] and
the command histogram to plot the probability distribution of “X”
along with axis labels and a title that includes the mean and
variance for “X”. (B) Use a while loop and the rand command to
generate “X1”, also of size [10000 1] but with each element of “X1”
being the mean of 2 “samples” generated using rand, i.e. a “sample
size” of 2 separate numbers...

1. Consider the following data that represents a random sample
out of a very large population: 0.43, 4.89, 5.29, 5.16, 0.59, 7.50,
4.48, 6.22 (a) Create a QQ plot of the data. Do you think it is
reasonable to assume that the population distribution is normal?
Explain your answer. (b) Denote µ to be the population mean.
Regardless of your answer to (a), use R to perform the bootstrap
with 2000 resamplings to create a 90% CI for µ. Since...

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 to perform the
bootstrap with 2000 resamplings to...

i.Bias of Sample Mean Draw 20 samples from the normal
distribution N(5, 4). Compute the mean of your 20 samples. Report
the bias of the sample mean
ii. Variance of Sample Mean (Continue of problem i) To estimate
the variance of the sample mean, we need to draw many different
samples of size 20. Now, we draw 1000 times a sample of size 20.
Store all the 1000 sample means. Report the variance of the
estimated sample mean. Hint: To...

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...

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 to perform
the bootstrap with 2000 resamplings to create...

An advantage of programming is the ability to perform millions
of calculations and dump it to a file for plotting. This can be
extremely useful for engineers if they are simulating or
characterizing a system. Below you will calculate data, write it to
a file, and plot the contents in excel.
a)
Create a csv file for writing. This can be done by creating a
file with the open method as we
have done in class but with a *.csv...

1. You want to obtain a sample to estimate a population
proportion. At this point in time, you have no reasonable estimate
for the population proportion. Your would like to be 99.9%
confident that you estimate is within 4% of the true population
proportion. How large of a sample size is required? n =
2. A regression analysis was performed to determine if there is
a relationship between hours of TV watched per day (xx) and number
of sit ups...

A sample from a Normal distribution with an unknown mean µ and
known variance
σ = 45 was taken with n = 9 samples giving sample mean of ¯ y =
3.6.
(a) Construct a Hypothesis test with significance level α = 0.05 to
test whether the
mean is equal to 0 or it is greater than 0. What can you conclude
based on the
outcome of the sample?
(b) Calculate the power of this test if the true value...

ADVERTISEMENT

Get Answers For Free

Most questions answered within 1 hours.

ADVERTISEMENT

asked 13 minutes ago

asked 16 minutes ago

asked 16 minutes ago

asked 28 minutes ago

asked 58 minutes ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago

asked 2 hours ago

asked 2 hours ago

asked 2 hours ago

asked 2 hours ago