Tutorial 2 of the Mimi.jl shows how to update a single value parameter with “update_param!”. Is it possible to use this function, or another function to update a vector array, such as “update_param!(m, :agcbm, 0.11)”, where agcbm is a 16 element vector? This expression gives error; “MethodError: no method matching getindex(::Symbol, ::Int64)”
@KGregory I believe your problem here is that you are trying to index into
:agcbm, which is not permitted within this function. If you want to update the vector array, you will need to replace the entire array, i.e.
update_param!(m, :agcbm, new_array] where the
new_array is a 16 element vector as well. Does that make sense for your use case? Of course, your new array might just be a replica of the original one used in
set_param! with the first value modified. I assume you can access that original vector from the original
set_param! function, or pulling the values out of the already run model?
Thank you for your reply.
agcbm is a random 16-element (RV), so update_param! only updates the default best estimates of agcbm for the 16 regions, correct? I created an AGcbm_new vector with all values larger than agcbm by 30% by;
AGcbm_new = AGcbm .* 1.3
update_param!(m, :agcbm, AGcbm_new)
for j = 1:16
AGcbm[j] = m[:impactagriculture, :agcbm][j]
which returns 16 values of 30% more than the original values. However, If a ran a Monte Carlo simulation the model would use the original RV, correct?
Yes that’s correct, the
update_param! function only updates the values in the “deterministic” version of the model, but then when you run the Monte Carlo simulation it will sample from its original random variables and will override whatever values are set in the single model.