Search icon CANCEL
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

Basic statistics concepts

In this recipe, you will learn about the StatsBase package, which helps you use basic statistical concepts such as weight vectors, common statistical estimates, distributions, and others.

Getting ready

To get started with this recipe, you have to first install the StatsBase package by executing Pkg.add("StatsBase") in the REPL.

How to do it...

  1. Weight vectors can be constructed as follows:
    w = WeightVec([4., 5., 6.])
    

    How to do it...

  2. Weight vectors also compute the sum of the weights automatically. So, if the sum is already computed, it can be added as a second argument to the vector construction so that it saves time required for computing the sum. Here is how to do it:
    w = WeightVec([4., 5., 6.], 15.)
    

    How to do it...

  3. Weights can also be simply defined by the weights() function, as follows:
    w = weights([1., 2., 3.])
    

    How to do it...

  4. Some important methods that can be used on weight vectors are:
    1. To check whether the weight vector is empty or not, the isemply() function can be used:
      isempty...
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 ₹800/month. Cancel anytime