Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Applied Statistics Expert

Lab: Exercise your R prowess!

Start the R software package. Select File/New script, and in the script box paste the following code:

clt<-function(sampleSize,samples=10000){

means<-numeric(samples)

for(j in 1:samples) {

means[j]<-mean(runif(sampleSize,0,1))

}

hist(means,xlab="Mean",

main=paste("Central Limit theorem demonstration\nVariance = ",round(sd(means)^2,8)),

xlim=c(0,1),ylim=c(0,4000),breaks=seq(0,1,0.05),

angle=60,density=25,col="dark green",border="black")

}

Highlight the code and press CTRL-r (hold down the control key and press "r"). This code creates a function that instructs R to collect means of 10000 samples of a given size and then print a frequency histogram of the 10000 means. Samples are chosen from a random number generator that selects numbers between 0 and 1. You can run the function for a sample size of 1 by clicking on the R console and then typing:

clt(1)

and pressing the enter key. Satisfy yourself that the underlying distribution is uniform.

Try running it for a range of sample sizes between 2 and 50 (for samples of size 5 the command is "clt(5)". In a paragraph comment on what happens to the frequency distributions. These distributions are known as "sampling distributions".

Note that the code also prints out the variance of the sample means. Run the code for samples of sizes 1, 5, 10, 20, 30, 40 and 50. Calculate the variance of the sampling distribution for each run and then graph variance against sample size. The R code for plotting y against x is:

plot(xVector, yVector, xlab="Label for the x-axis", ylab="Label for the y-axis")

where a vector is defined as a list of numbers separated by commas within the parentheses of "c( )". Try graphing variance against the inverse of sample size. Are the graphs you've encountered and created in this exercise consistent with the central limit theorem? What does the last one say about the utility of standard errors?

Attachment:- Assignment File.rar

Applied Statistics, Statistics

  • Category:- Applied Statistics
  • Reference No.:- M92717021

Have any Question?


Related Questions in Applied Statistics

Business statistics project assignment -there will be two

BUSINESS STATISTICS PROJECT ASSIGNMENT - There will be two parts to this assignment: Part A: Group Work (A Business Report) Part B: Individual Reflective Piece (A Ministerial Brief) The response to Part A must be provide ...

Business analytics and statistics research report -this

Business Analytics and Statistics Research Report - This assignment is based on fictional data. You are creating a business report for the CEO of a retail company called, Athlete Panda. It must be professional in present ...

Assignment -for each of the prompts below report the

Assignment - For each of the prompts below, report the appropriate degrees of freedom, t statistic, p-value and plot using the statistical software platform of your choice (R/STATA) 1) A sample of 12 men and 14 women hav ...

Exercise -q1 do the example data in table 35-2 meet the

Exercise - Q1. Do the example data in Table 35-2 meet the assumptions for the Pearson χ 2 test? Provide a rationale for your answer. Q2. Compute the χ 2 test. What is the χ 2 value? Q3. Is the χ 2 significant at α = 0.05 ...

Business data analysis computer assignment -part 1

Business Data Analysis Computer Assignment - PART 1 - Economists believe that high rates of unemployment are linked to decreased life satisfaction ratings. To investigate this relationship, a researcher plans to survey a ...

Applied statistics - regression assignmentin this

Applied Statistics - Regression Assignment In this assignment you are expected to set up a regression equation, run that regression and interpret and evaluate the results. You will need to carefully state all null hypoth ...

Construct a regression model for predicting total charges

Construct a regression model for predicting total charges from length of stay for DRG 105. a. State the null and alternative hypotheses and alpha level. b. Prepare a scatter diagram with the regression line for the two v ...

Assignment -in this assignment ms excel must be used to

Assignment - In this assignment MS Excel must be used to perform any calculations/graphical presentations as required in this assignment. Question 1 - Below you are given the examination scores of 20 students (data set a ...

You are expected to work in groups and write a research

You are expected to work in groups and write a research report. When you work on your report, you need to use the dataset, and other sources such as journal articles. If you use website material, please pay attention to ...

Quantitative methods in health statistical analysis report

Quantitative Methods in Health Statistical Analysis Report - Question 1 - Are you a Lark or an Owl? Studies indicate that about 10% of us are morning people (Larks) while 20% are evening people (Owls) and the rest are no ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As