Your _logpdf is not the same as Distributions._logpdf, so when you define
it on ::myDist, you're not extending Distributions.jl's function. You can
either import it with import Distributions._logpdf and define it as you do
above, or define it as
function *Distributions*._logpdf{T<:Real}(d::myDist, X::AbstractVector{T})
# code
end
Sam
On Tuesday, March 10, 2015 at 12:58:38 PM UTC-7, Benjamin Deonovic wrote:
>
> I'm trying to create a custom distribution. I define:
>
> immutable myDist <: DiscreteMultivariateDistribution
> #code
> end
>
>
>
>
> function _logpdf{T<:Real}(d::myDist, X::AbstractVector{T})
> # code
> end
>
>
> _pdf(d::myDist, X::AbstractVector) = exp(_logpdf(d, X))
>
>
>
> I can succesfully create a distribution (i.e. d = myDist(...)) and I can
> directly call _logpdf(d,x) on some data x. However, if I try to call
> logpdf(d,x) (which is defined by the Distributions package) I get
>
> ERROR: `_logpdf` has no method matching _logpdf(::myDist, ::Array{Int64,1})
> in logpdf at
> /Users/bdeonovic/.julia/v0.3/Distributions/src/multivariates.jl:66
>
> why is this??
>