Skip to content
New issue

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

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

Already on GitHub? # to your account

bugs in faem() #158

Closed
githubtomtom opened this issue Jun 29, 2021 · 0 comments
Closed

bugs in faem() #158

githubtomtom opened this issue Jun 29, 2021 · 0 comments

Comments

@githubtomtom
Copy link

calling fit(FactorAnalysis, x; method = :em) sometimes get:

ERROR: DomainError with -5.4988886678356523e-17:
log will only return a complex result if called with a complex argument. Try log(Complex(x)).
Stacktrace:
 [1] throw_complex_domainerror(f::Symbol, x::Float64)
   @ Base.Math ./math.jl:33
 [2] log(x::Float64)
   @ Base.Math ./special/log.jl:285
 [3] faem(S::Matrix{Float64}, mv::Vector{Float64}, n::Int64; maxoutdim::Int64, tol::Float64, maxiter::Int64)
   @ MultivariateStats ~/.julia/packages/MultivariateStats/HTpHt/src/fa.jl:72
 [4] fit(::Type{MultivariateStats.FactorAnalysis}, X::Matrix{Float64}; method::Symbol, maxoutdim::Int64, mean::Int64, tol::Float64, η::Float64, maxiter::Int64)
   @ MultivariateStats ~/.julia/packages/MultivariateStats/HTpHt/src/fa.jl:171

it is due to the following line inside faem() where detΣ can sometimes be slightly negative:

        L = (-n/2)*(d*log(2π) + log(detΣ) + tr(Σ⁻¹*S))
wildart added a commit to wildart/MultivariateStats.jl that referenced this issue Jan 25, 2022
wildart added a commit that referenced this issue Jan 25, 2022
* added docstrings, deprecated old functions
* added FA docs
* fixed tests
* fixed #157 &  #158
@wildart wildart closed this as completed Jan 26, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants