Hi all,
I have the following the optimization function in mata:
After completing the optimization I would like to drop the function using mata drop myopt() but I receive the error:
I can't seem to figure out why it would say the function is in use. Is there a way I can drop this function after running it?
Thank you!
George
I have the following the optimization function in mata:
Code:
mata
mata set matastrict off
void mvopt(todo, p, fml, g, H) {
fml=253*($m1*invlogit(p[1])+$m2*invlogit(p[2])+$m3*((1-invlogit(p[1])-invlogit(p[2]))))/*
*/-sqrt(253)*sqrt($s11*(invlogit(p[1]))^2+$s22*(invlogit(p[2]))^2+$s33*(1-invlogit(p[1])-invlogit(p[2]))^2 /*
*/+2*$s12*invlogit(p[1])*invlogit(p[2])/*
*/+2*$s13*invlogit(p[1])*(1-invlogit(p[1])-invlogit(p[2]))/*
*/+2*$s23*invlogit(p[2])*(1-invlogit(p[1])-invlogit(p[2])))
}
S = optimize_init()
optimize_init_evaluator(S, &mvopt())
optimize_init_which(S, "max")
optimize_init_params(S, (.3, .3))
(void) optimize(S)
p = optimize_result_params(S)
st_matrix("w",p)
end
After completing the optimization I would like to drop the function using mata drop myopt() but I receive the error:
Code:
mvopt() in use (nothing dropped)
Thank you!
George

Comment