Thanks a lot John for your answer! I'm starting in Julia so I'm still in 
the learning curve...

Do you know how I can convert Array{Float64, 2} to Array{Float64, 1}?

Thanks again!

Pam.

On Thursday, August 14, 2014 5:15:01 PM UTC+1, John Myles White wrote:
>
> In Julia, anything with a description like 1x27 Array{Any,2} is a matrix, 
> not a vector.
>
> Also, it's not the right kind of vector because it has no numeric type 
> restriction. It needs to be a vector of Float64 values, like you'd get from 
> doing something like:
>
> [1.0, 2.0, 3.0]
>
>  -- John
>
> On Aug 14, 2014, at 8:56 AM, [email protected] <javascript:> wrote:
>
> Hi all,
>
> I am getting an error when I try to obtain the probability density 
> evaluated at z1[1,;]:
>
> julia> pdf(MvNormal(zhat11,F11),z1[1,:])
>
> MethodError(logpdf,(GenericMvNormal{PDMat} distribution
>
> Dim: 27
>
> Zeromean: false
>
> μ:
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
>
> Σ: PDMat(27,27x27 Array{Float64,2}:
>
>  1.46955   1.08653   0.872691  0.73362   …  0.0       0.0       0.0     
>
>  1.08653   1.5808    0.948201  0.797096     0.0       0.0       0.0     
>
>  0.872691  0.948201  1.38173   0.640224     0.0       0.0       0.0     
>
>  0.73362   0.797096  0.640224  0.94777      0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0          0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0       …  0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0          0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0          0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0          0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0          0.0       0.0       0.0     
>
>  ⋮                                       ⋱            ⋮                 
>
>  0.0       0.0       0.0       0.0          0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0          0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0          0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0       …  0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0          0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0          0.408578  0.564983  0.610912
>
>  0.0       0.0       0.0       0.0          0.335025  0.463274  0.500935
>
>  0.0       0.0       0.0       0.0          1.41921   0.723169  0.781958
>
>  0.0       0.0       0.0       0.0       …  0.723169  1.79472   1.08129 
>
>  0.0       0.0       0.0       0.0          0.781958  1.08129   1.95214 
> ,Cholesky{Float64}(27x27 Array{Float64,2}:
>
>  1.21225   0.896288  0.719894  0.605172  …  0.0       0.0       0.0     
>
>  1.08653   0.881739  0.343604  0.288847     0.0       0.0       0.0     
>
>  0.872691  0.948201  0.863378  0.12198      0.0       0.0       0.0     
>
>  0.73362   0.797096  0.640224  0.695144     0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0          0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0       …  0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0          0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0          0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0          0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0          0.0       0.0       0.0     
>
>  ⋮                                       ⋱            ⋮                 
>
>  0.0       0.0       0.0       0.0          0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0          0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0          0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0       …  0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0          0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0          0.449492  0.621558  0.672087
>
>  0.0       0.0       0.0       0.0          0.313935  0.43411   0.469401
>
>  0.0       0.0       0.0       0.0          1.05765   0.290741  0.314376
>
>  0.0       0.0       0.0       0.0       …  0.723169  1.06555   0.345716
>
>  0.0       0.0       0.0       0.0          0.781958  1.08129   1.03041 ,'U'))
>
> ,{-0.18446029}))
>
>
>
>
> The MvNormal part works perfect alone: 
>
> julia> MvNormal(zhat11,F11)
>
> GenericMvNormal{PDMat} distribution
>
> Dim: 27
>
> Zeromean: false
>
> μ:
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
>
> Σ: PDMat(27,27x27 Array{Float64,2}:
>
>  1.46955   1.08653   0.872691  0.73362   …  0.0       0.0       0.0     
>
>  1.08653   1.5808    0.948201  0.797096     0.0       0.0       0.0     
>
>  0.872691  0.948201  1.38173   0.640224     0.0       0.0       0.0     
>
>  0.73362   0.797096  0.640224  0.94777      0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0          0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0       …  0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0          0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0          0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0          0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0          0.0       0.0       0.0     
>
>  ⋮                                       ⋱            ⋮                 
>
>  0.0       0.0       0.0       0.0          0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0          0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0          0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0       …  0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0          0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0          0.408578  0.564983  0.610912
>
>  0.0       0.0       0.0       0.0          0.335025  0.463274  0.500935
>
>  0.0       0.0       0.0       0.0          1.41921   0.723169  0.781958
>
>  0.0       0.0       0.0       0.0       …  0.723169  1.79472   1.08129 
>
>  0.0       0.0       0.0       0.0          0.781958  1.08129   1.95214 
> ,Cholesky{Float64}(27x27 Array{Float64,2}:
>
>  1.21225   0.896288  0.719894  0.605172  …  0.0       0.0       0.0     
>
>  1.08653   0.881739  0.343604  0.288847     0.0       0.0       0.0     
>
>  0.872691  0.948201  0.863378  0.12198      0.0       0.0       0.0     
>
>  0.73362   0.797096  0.640224  0.695144     0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0          0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0       …  0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0          0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0          0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0          0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0          0.0       0.0       0.0     
>
>  ⋮                                       ⋱            ⋮                 
>
>  0.0       0.0       0.0       0.0          0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0          0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0          0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0       …  0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0          0.0       0.0       0.0     
>
>  0.0       0.0       0.0       0.0          0.449492  0.621558  0.672087
>
>  0.0       0.0       0.0       0.0          0.313935  0.43411   0.469401
>
>  0.0       0.0       0.0       0.0          1.05765   0.290741  0.314376
>
>  0.0       0.0       0.0       0.0       …  0.723169  1.06555   0.345716
>
>  0.0       0.0       0.0       0.0          0.781958  1.08129   1.03041 ,'U'))
>
>
> But then it doesn't work when I applied the pdf evaluated at z1[:,1]. Just in 
> case, z1[:,1] is defined as a vector:
>
>
> 1x27 Array{Any,2}:
>  -0.18446  -0.291912  -0.785919  -2.2007  …  0.395422  0.634415  0.0240087
>
> Hope someone could help me!!!!
>
> Thanks a lot!!!
>
> Pam.
>
>
>

Reply via email to