Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: programming in stata - problems with optimize

From   "A.J van der Vlist" <>
To   <>
Subject   st: programming in stata - problems with optimize
Date   Fri, 22 Jul 2011 22:19:00 +0200

Dear Statalisters,
I encouter problems in optimizing function f:
I would like to solve for mu:
 sum over i {  Nx_i' * (mu - Xbeta_i) } = Sk 
Nx = [n x 1] , vector of {1/n}'s  in order to sum over i
mu = parameter 
Xbeta = [n x 1] vector of fitted values
Sk = scalar
This is what I tried:
scalar Sk1=Sm1_SRA
void mymodelb(todo, mu2, f, g, H)
external Nx, X 
hlp=(mu2 :- X)
f = (Nx' * normal(hlp)) - Sk1 
S = optimize_init()
optimize_init_evaluator(S, &mymodelb())
optimize_init_params(S, 0)
mu2 = optimize(S)
1) I get problems when running with Sk1 in f
2) when I substitute for Sk1 =0.501 in f the code will give a result - yet unreasonable high +e11
Suggestions are very welcome.
*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index