# Path: pydlm/base/tools.py
# def getInterval(means, var, p):
#     alpha = abs(normal_CDF_inverse(min(1 - p, p) / 2))
#     upper = [0] * len(means)
#     lower = [0] * len(means)
#     for i in range(0, len(means)):
#         upper[i] = means[i] + alpha * math.sqrt(var[i])
#         lower[i] = means[i] - alpha * math.sqrt(var[i])
# 
#     return (upper, lower)


import matplotlib.pyplot as plt
from pydlm.base.tools import getInterval

        plotData(time=time[start:end],
                 data=data,
                 showDataPoint=options.showFittedPoint,
                 color=options.predictedColor,
                 label='predicted state')

        if options.showConfidenceInterval:
            upper, lower = getInterval(data, var, p=options.confidence)

            plotInterval(time=time[start:end],
                         upper=upper, lower=lower,
                         intervalType=options.intervalType,
                         color=options.predictedColor)

    # plot smoothed results if needed
    if options.plotSmoothedData:
        start = result.smoothedSteps[0]
        end = result.smoothedSteps[1] + 1
        data = [item[dimension, 0] for item in result.smoothedState[start:end]]
        var = [abs(item[dimension, dimension])
               for item in result.smoothedCov[start:end]]

        plotData(time=time[start:end],
                 data=data,
                 showDataPoint=options.showFittedPoint,
                 color=options.smoothedColor,
                 label='smoothed state')

        if options.showConfidenceInterval:

# Path: pydlm/base/tools.py
# def getInterval(means, var, p):
#     alpha = abs(normal_CDF_inverse(min(1 - p, p) / 2))
#     upper = [0] * len(means)
#     lower = [0] * len(means)
#     for i in range(0, len(means)):
#         upper[i] = means[i] + alpha * math.sqrt(var[i])
#         lower[i] = means[i] - alpha * math.sqrt(var[i])
# 
#     return (upper, lower)


# Path: pydlm/plot/dlmPlot.py
import matplotlib.pyplot as plt
from pydlm.base.tools import getInterval


        plotData(time=time[start:end],
                 data=data,
                 showDataPoint=options.showFittedPoint,
                 color=options.predictedColor,
                 label='predicted state')

        if options.showConfidenceInterval:
            upper, lower = getInterval(data, var, p=options.confidence)

            plotInterval(time=time[start:end],
                         upper=upper, lower=lower,
                         intervalType=options.intervalType,
                         color=options.predictedColor)

    # plot smoothed results if needed
    if options.plotSmoothedData:
        start = result.smoothedSteps[0]
        end = result.smoothedSteps[1] + 1
        data = [item[dimension, 0] for item in result.smoothedState[start:end]]
        var = [abs(item[dimension, dimension])
               for item in result.smoothedCov[start:end]]

        plotData(time=time[start:end],
                 data=data,
                 showDataPoint=options.showFittedPoint,
                 color=options.smoothedColor,
                 label='smoothed state')

        if options.showConfidenceInterval:

            upper, lower = getInterval(data, var, p=options.confidence)