Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Julia Cookbook

You're reading from  Julia Cookbook

Product type Book
Published in Sep 2016
Publisher
ISBN-13 9781785882012
Pages 172 pages
Edition 1st Edition
Languages
Authors (2):
Raj R Jalem Raj R Jalem
Jalem Raj Rohit Jalem Raj Rohit
Profile icon Jalem Raj Rohit
View More author details

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:

  2. Now, as we have seen how to randomly sample an element from a population, we would now see how to randomly sample...

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 €14.99/month. Cancel anytime}