Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with non-diagonal covariance matrices in model definition #174

Open
wlwetzel opened this issue Jul 7, 2023 · 0 comments
Open

Issue with non-diagonal covariance matrices in model definition #174

wlwetzel opened this issue Jul 7, 2023 · 0 comments

Comments

@wlwetzel
Copy link

wlwetzel commented Jul 7, 2023

I was attempting to define a mamba model with a multivariate normal distribution for the data:

model = Model(
    PMT = Stochastic(1,
        (mu,sigma) -> MvNormal(mu,sigma),
        false),
    mu = Logical(1,
        (x,y) -> makeMeans(x,y)
        ),
    sigma = Logical(2 ,
        (x,y) -> makeCov(x,y)
        ),
    x = Stochastic(
        () -> Normal(0,1)
        ),
    y = Stochastic(
        () -> Normal(0,1)
        )
)

makeMeans and makeCov return a length 4 vector and a 4x4 matrix.

I get the following error when trying to run mcmc:

ERROR: MethodError: no method matching PDMats.PDMat(::ArrayLogical{2})
Closest candidates are:
  PDMats.PDMat(::AbstractMatrix, ::Cholesky) at ~/.julia/packages/PDMats/HCniD/src/pdmat.jl:12
  PDMats.PDMat(::Cholesky) at ~/.julia/packages/PDMats/HCniD/src/pdmat.jl:21
  PDMats.PDMat(::Symmetric) at ~/.julia/packages/PDMats/HCniD/src/pdmat.jl:20

I can run mcmc if I replace sigma with a scalar, so it seems it's an issue with using a matrix for the covariance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant