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 9165893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:01:03+00:00 2026-06-17T15:01:03+00:00

I am a beginner in R. I am working on creating a relative frequency

  • 0

I am a beginner in R.

I am working on creating a relative frequency histogram (from random uniform numbers with 1,000 samples of 2) with a normal curve over-layed on top.

So far this is my attempt at the code:

set.seed(32423432)
x1 <-runif(2000,0,1)
m<-matrix(x1,ncol=2)
msum<-apply(m,1,sum)
bins=seq(-4,4,by=.2)
msum2<-msum/2
msum2<-msum2-(1/2)
msum2<-msum2*sqrt(2)
hist(msum2,breaks=bins, freq= FALSE, right=FALSE)

I have a few problems with this:

  1. the percentage on the y-axis makes no sense to me (I would expect to see something between 0 and .5)
  2. I should see way more bins
  3. I have no idea how to change the x-axis labels to every .4
  4. I cannot seem to get a normal curve on top of this histogram
  • 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-06-17T15:01:05+00:00Added an answer on June 17, 2026 at 3:01 pm
    1. Density sums to one over the whole plot (note that your interval sizes are less than 1).
      See ?hist “If all(diff(breaks) == 1), they are the relative frequencies counts/n”
    2. You would see more bins if msum2 had a greater range

      range(msum2)
      [1] -0.6918129 0.6795006

      hist(c(1,1,3,3 -3.5,-3.5, msum2),breaks=bins, freq= FALSE, right=FALSE)

    3.

    hist(msum2,breaks=bins, freq= FALSE, right=FALSE, xaxt="n")
    axis(1,at=bins,labels=bins)
    

    4 . Normal curve

    x <- seq(-4, 4, length=100)

    `lines(x,dnorm(x))`
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

PHP beginner working from a tutorial. I'm trying to do a simple upload from
I am beginner in C# and I am working with floating point numbers. I
I am a beginner in magento and am working on creating a website using
I am using NHibernate for my project. i am quite a beginner at working
Beginner here trying to get a pipeline working in bash. If somebody can see
I am a beginner in Java and am working on a Mastermind project for
I am a beginner to the iOS app development and working on a sample
I am a beginner-verging-on-intermediate rails developer that is working hard to improve my skills.
As a beginner in Ocaml, I have this current working code: ... let ch_in
I've got all the tutorials up to beginner #5 translated and working, but I

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.