Skip to content

Commit

Permalink
Update functions_estimation.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel E Kreindler authored and Gabriel E Kreindler committed Nov 2, 2024
1 parent 28b346f commit b8ef222
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/functions_estimation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ function fit_twostep(

### optimal weight matrix
Wstep2_path = opts.path * "Wstep2.csv"
if isfile(Wstep2_path)
if (opts.path != "") && isfile(Wstep2_path)
(opts.trace > 0) && print(">>> Starting GMM step 2. Reading optimal weight matrix from file... ")
Wstep2 = readdlm(Wstep2_path, ',', Float64)
(opts.trace > 0) && println("DONE")
Expand All @@ -280,8 +280,12 @@ function fit_twostep(
Wstep2 = inv(Wstep2)

# Save Wstep2 to file
writedlm(Wstep2_path, Wstep2, ',')
(opts.trace > 0) && println("DONE and saved to file")
if (opts.path != "")
writedlm(Wstep2_path, Wstep2, ',')
(opts.trace > 0) && println("DONE and saved to file")
else
(opts.trace > 0) && println("DONE")
end
end

### Step 2
Expand Down

0 comments on commit b8ef222

Please sign in to comment.