Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7180289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:18:57+00:00 2026-05-28T17:18:57+00:00

I am working with the language [R] to generate a sample of M =

  • 0

I am working with the language [R] to generate a sample of M = 32000 averages each calculated by averaging 36 independent values ​​of the random variable continuous uniform distribution (0, 1) is generated as follows:

sampleA<-1:32000

for ( i in 1:32000){
    MuestraAUnif<- runif(36)
    sampleA[i]<-mean(MuestraAUnif)
}

For the sample generated ask me calculate relative frequency of observed averages greater than L = 0.32 +4 * 1 / 100 and compare it with the probability (approximated by “Central limit theorem“) that the average N values ​​greater than L. as follows:

    L<- 0.32+4*1/100
    sigma<- sqrt(1/12) #(b-a)/12 
    miu = 0.5 #(a+b)/2
    greaterA <-sum(sampleA > L) #values of the sample greater than L are 23693
    xBar<- greaterA/length(sampleA) 
    X <- sum(sampleA) 
    n<-32000
    Zn<- (X - n*miu)/(sigma*sqrt(n))

    cat("P(xBar >",L,") = P(Z>", Zn, ")=","1 - P (Z < ", Zn,") =",1-pnorm(Zn),"\n") #print the theoretical prob Xbar greater than L
    cat("sum (sampleA >",L,")/","M=", n," para N =", 36,":",xBar, "\n") #print the sampling probability print when is greater than L

The output is:

P(xBar > 0.36 ) = P(Z> -3.961838 )= 1 - P (Z <  -3.961838 ) = 0.9999628 
sum (sampleA > 0.36 )/ M= 32000  para N = 36 : 0.7377187 

My question is: Why are so far values​​?, Presumably they should be much closer (0.9999628 is far from 0.7377187). Am I doing something wrong with my implementation?. Excuse my English.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T17:18:58+00:00Added an answer on May 28, 2026 at 5:18 pm

    Melkhiah66. You did everything right only change
    MuestraAUnif<- runif(2) for MuestraAUnif<- runif(32)
    and it should work

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on developing my own programming language, and to generate executables I wished
I want to generate random numbers manually. I know that every language have the
I'm working ona toy programming language. I use LLVM to generate machine code. Now
I've been working with R language, I've created a histogram from a data file
I'm working on a multi-language website. I have a problem with the color of
I'm working on highlighting a small scripting language (that is not a derivative of
Working with a Visual Basic.NET console application that features a VERY BASIC natural language
I have started working on a project which requires Natural Language Processing. We have
I'm currently working on a compiler for a language (an external byte-code), and am
I'm working on a project about PDF rendering in the C# language. I convert

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.