The implementation of--bootstrap--r language by pulling Boots method

Source: Internet
Author: User

The pull-out method belongs to the repeated sampling (resampling) method, which differs from the Monte Carlo in the real matrix. It is the repeated sampling of the observed values as the mother,

In order to obtain the information characteristics which are less than two of the original data cannot be explored.

For example, assuming that x1,x2,..., xn as an observation from the same allocation, we would like to know the median of this allocation.

Set up a group of random samples with Poisson allocation, 6 7 7 7 7 8 ... 15 15 17 20, a total of 30. The median number of known samples is 10.

Here we use the MC method and the Bootstrap method to simulate 10,000 times, the distribution of the median number.

# Monte Carlot1 = nullfor (i in 1:10000) {  X1=rpois (30,10); Y1=median (x1); T1=c (t1,y1)}# Bootstrapt2 = NULLx0 = Rpois (30, (i in 1:10000) {  x2=sample (x0,30,t); Y2=median (x2); T2=c (t2,y2)}par (mfrow=c) hist (T1,xlab = "median", Main = "Monte Carlo") hist (T2,xlab = "Median", main = "Bootstrap")

Output:

After testing the difference between the two standards, found that the difference is not large:

The implementation of--bootstrap--r language by pulling Boots method

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.