GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Math::Random::OO::Bootstrap(3) User Contributed Perl Documentation Math::Random::OO::Bootstrap(3)

Math::Random::OO::Bootstrap - Generate random numbers with bootstrap resampling from a non-parametric distribution

version 0.22

  use Math::Random::OO::Bootstrap;
  @sample = qw( 2 3 3 4 4 5 5 6 6 7 );
  $prng = Math::Random::OO::Bootstrap->new(@sample);
  $prng->seed(42);
  $prng->next() # draws randomly from the sample

This subclass of Math::Random::OO generates random numbers with bootstrap resampling (i.e. resampling with replacement) from a given set of observations. Each item in the sample array is drawn with equal probability.

 $prng = Math::Random::OO::Bootstrap->new(@sample);
 $prng = Math::Random::OO::Bootstrap->new(\@sample);

"new" takes either a list or a reference to an array containing a set of observations and returns a new "Math::Random::OO::Bootstrap" object. If a reference is provided, the object will make an internal copy of the array to avoid unexpected results if the source reference is modified.

If the desired sample is an array of array references, the list must be enclosed in an anonymous array reference to avoid ambiguity.

 @sample = ( [ 1, 2, 3], [2, 3, 4] );

 # Correct way
 $prng = Math::Random::OO::Bootstrap->new( [ @sample ] );
 
 # Incorrect -- will only use [1, 2, 3] as the desired sample
 $prng = Math::Random::OO::Bootstrap->new( @sample );

It is an error to call "new" with no arguments.

 $rv = $prng->seed( @seeds );

This method seeds the random number generator. At the moment, only the first seed value matters. It should be a positive integer.

 $rnd = $prng->next();

This method returns the next random number from the random number generator by resampling with replacement from the provided data. It does not take any parameters.

David Golden <dagolden@cpan.org>

This software is Copyright (c) 2013 by David Golden.

This is free software, licensed under:

  The Apache License, Version 2.0, January 2004
2013-06-09 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.