You could also do something like the following
function OneStep(θ,SampleMoments,T,W)
#ρ_guess = θ[1]
#σ_guess = θ[2]
#(θ[2]^2)/(1-θ[1]^2) = σ^2/(1-ρ^2)
moments = [
((θ[1]^(j-t))*(θ[2]^2)/(1-θ[1]^2) - SampleMoments[count])
for t in 1:T for j in 1:T
]
return diff'*W*moments
end
That way the vector moments
you create has the right type from the start