Question

In: Math

3. (3 pt) Use R functions to generate 1000 random samples from t-distribution with 15 degrees...

3. (3 pt) Use R functions to generate 1000 random samples from t-distribution with
15 degrees of freedom. Make a histogram with the samples showing the relative
frequencies. Then overlay a probability density plot over this histogram.

Solutions

Expert Solution

Find below the R code with comments. I assume that you are knowledgeable regarding the theory behind t-dictribution.

x=rnorm(1000) #generate 1000 random values
hist(x, main="1.2a Histogram of 1000 Random N(0,1) Values") #plot histogram

x.grid=seq(-3,3,.01) # create vector of x values

v.sim=(rnorm(1000))^2 + (rnorm(1000))^2 + (rnorm(1000))^2
t.sim = x / sqrt(v.sim/15) # t-distribution of the 1000 random values with 15 degrees of freedom (formulae)

#plotting histogram of t-distribution
hist(t.sim,probability="TRUE", nclass=50,
main="4.2b Histogram of 1000 Random t(df=15) Values\n (density scale)")

#Probability density graph
t.grid=seq(min(t.sim),max(t.sim),.01) #Create vector of x values
density.t.grid=dt(t.grid,df=15) # Compute vector of corresponding density values
lines(t.grid,density.t.grid,col='blue') # use R function lines() to add to current plot

I hope this will give you the desired graph.


Related Solutions

Use R and perform following: Generate 1000 observations from an exponential distribution with mean 10. Generate...
Use R and perform following: Generate 1000 observations from an exponential distribution with mean 10. Generate 1000 observations from a central t-distribution with 8 degree of freedom. Make a qqplot of observations in problem 1 versus quantiles generated from a t-distribution with 8 degree of freedom. Can the t distribution be used to approximate data in part 1?Submit the plot. Repeat above part but submit a qqplot of the observations in 1 versus quantiles from an exponential with mean 1....
Generate 1000 random numbers from ??3? starting with standard normal random numbers in R.
Generate 1000 random numbers from ??3? starting with standard normal random numbers in R.
a.) Use a t-distribution to answer this question. Assume the samples are random samples from distributions...
a.) Use a t-distribution to answer this question. Assume the samples are random samples from distributions that are reasonably normally distributed, and that a t-statistic will be used for inference about the difference in sample means. State the degrees of freedom used. Find the endpoints of the t-distribution with 2.5% beyond them in each tail if the samples have sizes n1=16 and n2=29 . Enter the exact answer for the degrees of freedom and round your answer for the endpoints...
(R programming) Generate 50 samples from a Poisson distribution with lambda to be 2 and define...
(R programming) Generate 50 samples from a Poisson distribution with lambda to be 2 and define the log likelihood function Use optimization to find the maximum likelihood estimator of lambda. Repeat for 100 times using forloop. You will need to save the results of the estimated values of lambda.
Generate 1000 random numbers from ??2, 5? starting with standard normal random numbers in R.
Generate 1000 random numbers from ??2, 5? starting with standard normal random numbers in R.
Use R to generate n = 400 samples (idependent identically distributed random numbers) of X ∼...
Use R to generate n = 400 samples (idependent identically distributed random numbers) of X ∼ N(0, 4). For each Xi , simulate Yi according to Yi = 3 + 2.5Xi + εi , where εi ∼ N(0, 16), i = 1, ..., n. Use R to solve the following questions. (a) Compute the least square estimators of βˆ 0 and βˆ 1. (b) Draw a regression line according to the numbers computed in (a). Plot Y and X with...
Find the value of t for a t-distribution with 3 degrees of freedom such that the...
Find the value of t for a t-distribution with 3 degrees of freedom such that the area to the left of t equals 0.10. Possible Answers: A. 5.841 B. 4.541 C. -2.333 D. -1.638
in R. Generate a random sample of size 700 from a gamma distribution with shape parameter...
in R. Generate a random sample of size 700 from a gamma distribution with shape parameter 8 and scale parameter 0.1. Create a histogram of the sample data. Draw the true parametric density (for the specified gamma distribution) on the histogram. The curve for the density should be red. (Note: The “true parametric density” is the distribution from which the sample values were generated. It is NOT the kernel density that is estimated from the data.)
For a t-distribution with 15 degrees of freedom, 90% of the distribution is within how many...
For a t-distribution with 15 degrees of freedom, 90% of the distribution is within how many standard deviations of the mean? Select one: a. 1.235 b. 1.576 c. 1.753 d. 1.960
Use R to generate two random numbers n11, n21 from the Binomial distribution: Bin(10, 0.4). Print...
Use R to generate two random numbers n11, n21 from the Binomial distribution: Bin(10, 0.4). Print your results. Please don’t forget to use the command set.seed(101) before the commands gen- erating the random numbers. (b) (2 points) Use the R command ntable < − array(data = c(n11, n21, n1plus-n11, n2plus-n21), dim = c(2,2)) to create a 2 × 2 table using the numbers generated in part (a) above. Print your table. (c) (3 points) Perform the Fisher’s exact test on...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT