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...
- Weight vectors can be constructed as follows:
w = WeightVec([4., 5., 6.])
- 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.)
- Weights can also be simply defined by the
weights()
function, as follows:w = weights([1., 2., 3.])
- Some important methods that can be used on weight vectors are:
- To check whether the weight vector is empty or not, the
isemply()
function can be used:isempty...
- To check whether the weight vector is empty or not, the