R combat: "Common functions" rnorm normal distribution _r

Source: Internet
Author: User

R Combat Series Column

Rnorm Normal distribution (the normal distribution) function

The function Rnorm of the whole distribution function is declared as follows:

Rnorm (n, mean = 0, SD = 1)

N: Produce random number of numbers

Mean: Expectation

SD: Is Variance

Produces 1000 random numbers, obeys the standard normal distribution

> rnorm (1000)
   [1] -1.236751e+00  3.366310e-02-1.118280e+00  2.248415e-01  1.036253e+00
   [6]- 4.981205e-01  1.417859e+00  7.423066e-01-1.649157e+00  4.752631e-02
  [one]  2.947828e-01- 1.693057e+00  3.417998e-01  8.506275e-01  2.413585e-01
  [1.205450e-01-1.098822e+00]  - 1.944444e-01  1.247038e+00-2.301569e+00
  [2.241360e-01]  1.447203e+00  1.045240e+00  8.210854e-01-1.949543e+00

Draw out these 1000 numbers

> x<-rnorm (1000)
> plot (seq (length (x)), X)

To draw a functional image of a standard global distribution

> X<-rnorm (3000) #生成3000个数字, conforms to the standard is too distributed
> Curve (dnorm (x), from=-5,to=5) #dnorm输入x求出其正太分布函数, curve draw the function interval [ -5,5] image on



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.