I have a code taht is more or less like this:
fixed parameters \alpha, \beta... that never changes
#then I have vector of parameters I want to calibrate (theta) and target (mom_data)
theta = [ *vector of parameters to calibrate*]
mom_data[ *vector of moments in the real data* ]
#a function to solve the model:
#it uses \alpha and \beta, but in order to simplify, I put it just in function of vector theta
function solve_model(theta)
return mom_model = [ *vector of moments in the model given theta*]
end
#and a function that calibrate it:
function calibrate(theta, mom_data)
model_target = model(theta)
error = (model_target - mom_data)/mom_data
return error'*I(length(error))*error #whete I(n) is identity matrix
end
#finally, I want to calibrate
r = optimize(x -> calibrate(x, mom_data), initial_guess)
So, first of all, I would like to know if this structure is correct to you guys, or is there anything I can do to improve it.
However, the important question I would like to do is this: I have a parameter \rho that I want to estimate, so, it is inside vector theta. However, I want to set a target to it as well, so it does not deviate a lot from the value I want. I mean, the point is that I want to set \rho = 1, but in order to improve calibration in other dimensions, I would let it vary a bit.
How can I do this? I am struggling because this \rho would appear as a part of theta (since I am estimating it), but as a target, since I woul be trying to set it equals to 1