Skip to content

MvStudentT distribution random method producing anomalous values #4008

Closed
@bsmith89

Description

@bsmith89

Description of your problem

Please provide a minimal, self-contained, and reproducible example.

import pymc3 as pm
import numpy as np

np.random.seed(1)

y_dist = (
    pm.MvStudentT.dist(mu=np.array([0, 0]),
                       cov=np.array([[1, 0.5],
                                     [0.5, 1]]),
                       nu=1000)
)
y = y_dist.random(size=100)

print(np.cov(y.T))
# Produces
# [[0.00070349 0.00033094]
#  [0.00033094 0.00086568]]
# for me.

This is clearly far from the expected covariance estimate and reflects
that the data are all close to 0, e.g.

[[-0.0354673  -0.05517701]
 [ 0.03031922 -0.00241219]
 [ 0.01348659 -0.06386095]
 [-0.03874406 -0.06483306]
 [-0.00504599 -0.01334566]
 [-0.00685522 -0.06665865]
 [ 0.01513208  0.00279986]
 [-0.01452284 -0.05150485]
 [ 0.0196839  -0.0096905 ]
 [-0.00998187  0.00775652]
...
]

And get progressively smaller with increasing values of nu.

Versions and main components

  • How did you install PyMC3: pip and conda
  • PyMC3 Version: 3.8 (development install at commit e47b98a)
  • Theano Version: 1.0.4 (conda build key: py37hfd86e86_0)
  • Python Version: 3.7.6 (conda build key: h0371630_2)
  • Operating system:
$ hostnamectl
Operating System: RHEL
CPE OS Name: cpe:/o:redhat:enterprise_linux:7.8:GA:server
Kernel: Linux 3.10.0-1127.10.1.el7.x86_64
Architecture: x86-64

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions