# MultivariateStats - Factor Analysis - transform/reconstruct not working?

In factor analysis transforming observations into latent variables or reconstructing observations from latent variables seem to be not working? (Factor Analysis — MultivariateStats 0.1.0 documentation)

``````using MultivariateStats
X = [0.635098  0.548183  0.211851    0.171408  0.877398;
0.348466  0.498276  0.00646129  0.374103  0.21937;
0.172254  0.593525  0.319492    0.706334  0.51062;
0.994453  0.542042  0.155406    0.165663  0.196073]
M = fit(FactorAnalysis, X; maxoutdim=4, method=:em)
x1 = [1,0,0,0]
y1 = transform(M,x1)
ERROR: MethodError: no method matching transform(::FactorAnalysis{Float64}, ::Vector{Int64})
Closest candidates are:
transform(::Whitening, ::AbstractVecOrMat{T} where T) at /Users/julio/.julia/packages/MultivariateStats/HTpHt/src/whiten.jl:38
transform(::PCA{T}, ::AbstractVecOrMat{T}) where T<:Real at /Users/julio/.julia/packages/MultivariateStats/HTpHt/src/pca.jl:46
transform(::PPCA{T}, ::AbstractVecOrMat{T}) where T<:Real at /Users/julio/.julia/packages/MultivariateStats/HTpHt/src/ppca.jl:22
...
Stacktrace:
[1] top-level scope
@ REPL[5]:1

y2 = [1,0,0,0]
x2 = reconstruct(M, y2)
ERROR: MethodError: no method matching reconstruct(::FactorAnalysis{Float64}, ::Vector{Int64})
Closest candidates are:
reconstruct(::PCA{T}, ::AbstractVecOrMat{T}) where T<:Real at /Users/julio/.julia/packages/MultivariateStats/HTpHt/src/pca.jl:47
reconstruct(::PPCA{T}, ::AbstractVecOrMat{T}) where T<:Real at /Users/julio/.julia/packages/MultivariateStats/HTpHt/src/ppca.jl:30
reconstruct(::KernelPCA{T}, ::AbstractVecOrMat{T}) where T<:Real at /Users/julio/.julia/packages/MultivariateStats/HTpHt/src/kpca.jl:61
...
Stacktrace:
[1] top-level scope
@ REPL[7]:1
``````

the problem is that you’re putting a vector of integers into `transform()`, but it wants a vector of floats.

(note that this is actually what the error says: `transform()` is not implemented for `Vector{Int64}`)

if you do

``````x1 = [1., 0., 0., 0.]
``````