<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 (numba_for_arviz)=
Numba -  an overview
Numba is a just-in-time compiler for Python that works best on code that uses NumPy arrays and functions, and loops.
ArviZ includes {ref}Numba as an optional dependency &lt;Optional-dependencies&gt; and a number of functions have been included in utils.py for systems in which Numba is pre-installed. Additional functionality, {class}arviz.Numba, of disabling/re-enabling numba for systems that have Numba installed has also been included.
A simple example to display the effectiveness of Numba
Step1:  That is almost 300 times faster!! Let's compare this to NumPy
Step2:  In certain scenarios, Numba can even outperform NumPy! 
Numba within ArviZ
Let's see Numba's effect on a few of ArviZ functions
Step3:  The methods of the {class}~arviz.Numba class can be used to enable or disable numba. The attribute numba_flag indicates whether numba is enabled within ArviZ or not.
<ASSISTANT_TASK:>
Python Code:
import arviz as az
import numpy as np
import timeit
from arviz.utils import conditional_jit, Numba
from arviz.stats.diagnostics import ks_summary
data = np.random.randn(1000000)
def variance(data, ddof=0):  # Method to calculate variance without using numba
    a_a, b_b = 0, 0
    for i in data:
        a_a = a_a + i
        b_b = b_b + i * i
    var = b_b / (len(data)) - ((a_a / (len(data))) ** 2)
    var = var * (len(data) / (len(data) - ddof))
    return var
%timeit variance(data, ddof=1)
@conditional_jit
def variance_jit(data, ddof=0):  # Calculating variance with numba
    a_a, b_b = 0, 0
    for i in data:
        a_a = a_a + i
        b_b = b_b + i * i
    var = b_b / (len(data)) - ((a_a / (len(data))) ** 2)
    var = var * (len(data) / (len(data) - ddof))
    return var
%timeit variance_jit(data, ddof=1)
Explanation: (numba_for_arviz)=
Numba -  an overview
Numba is a just-in-time compiler for Python that works best on code that uses NumPy arrays and functions, and loops.
ArviZ includes {ref}Numba as an optional dependency &lt;Optional-dependencies&gt; and a number of functions have been included in utils.py for systems in which Numba is pre-installed. Additional functionality, {class}arviz.Numba, of disabling/re-enabling numba for systems that have Numba installed has also been included.
A simple example to display the effectiveness of Numba
End of explanation
%timeit np.var(data, ddof=1)
Explanation: That is almost 300 times faster!! Let's compare this to NumPy
End of explanation
summary_data = np.random.randn(1000, 100, 10)
school = az.load_arviz_data("centered_eight").posterior["mu"].values
Explanation: In certain scenarios, Numba can even outperform NumPy! 
Numba within ArviZ
Let's see Numba's effect on a few of ArviZ functions
End of explanation
Numba.disable_numba()
Numba.numba_flag
%timeit ks_summary(summary_data)
%timeit ks_summary(school)
Numba.enable_numba()
Numba.numba_flag
%timeit ks_summary(summary_data)
%timeit ks_summary(school)
Explanation: The methods of the {class}~arviz.Numba class can be used to enable or disable numba. The attribute numba_flag indicates whether numba is enabled within ArviZ or not.
End of explanation
<END_TASK>