Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Julia Cookbook

You're reading from   Julia Cookbook Over 40 recipes to get you up and running with programming using Julia

Arrow left icon
Product type Paperback
Published in Sep 2016
Publisher
ISBN-13 9781785882012
Length 172 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (2):
Arrow left icon
Raj R Jalem Raj R Jalem
Author Profile Icon Raj R Jalem
Raj R Jalem
Jalem Raj Rohit Jalem Raj Rohit
Author Profile Icon Jalem Raj Rohit
Jalem Raj Rohit
Arrow right icon
View More author details
Toc

Sampling

Sampling is the process where by sample units are selected from a large population for analysis. The sample should be selected such that the results and inferences generated from them should be fairly applicable and can be generalized to the population from which it was initially sampled. There are a lot of ways in which sampling can be done. We will discuss them in the How to do it... section.

Getting ready

You have to have the StatsBase package ready. This can be done by running using StatsBase in the REPL.

How to do it...

  1. The simplest way of sampling is random sampling, where one can draw a random element from the array, which is the population. This kind of sampling is generally used for ensuring that selection bias does not happen. This kind of sampling can be done using the sample() function of the StatsBase package:
    sample(x)
    

    The output would look like the following:

    How to do it...

  2. Now, as we have seen how to randomly sample an element from a population, we would now see...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime