Hi, everyone!
I'm trying to solve the simultaneous system of two equation to get the daily data of variables va and siga (given the initial values va_init and siga_init).
a = {va} * normal((log({va}/c)+(b+0.5*({siga}^2)))/ {siga}) -c* exp(-(b))* normal(((log({va}/c)+(d+0.5*({siga}^2)))/ {siga})-{siga})
d = ({va}/a)* normal((log({va}/c)+(b+0.5*({siga}^2)))/ {siga})*{siga}
I'm using -nlsur in stata to get them, but for some reason the formula cannot calculate these value for each observation (which is needed here), but only for the group.
Here is the formula I use:
nlsur (a = {va} * normal((log({va}/c)+(b+0.5*({siga}^2)))/ {siga}) -c* exp(-(b))* normal(((log({va}/c)+(d+0.5*({siga}^2)))/ {siga})-{siga})) (d = ({va}/a)* normal((log({va}/c)+(b+0.5*({siga}^2)))/ {siga})*{siga}), initial(va va_init[_n] siga siga_init[_n])
If I try to calculate it the following way:
by one, sort: nlsur (a = {va} * normal((log({va}/c)+(b+0.5*({siga}^2)))/ {siga}) -c* exp(-(b))* normal(((log({va}/c)+(d+0.5*({siga}^2)))/ {siga})-{siga})) (d = ({va}/a)* normal((log({va}/c)+(b+0.5*({siga}^2)))/ {siga})*{siga}), initial(va va_init[_n] siga siga_init[_n])
--> I get the error: cannot have fewer observations than parameters
But this is exactly what I need to calculate:
Does anyone know the solution for my problem?
I also attach the example file, so that you can try it.
I'm trying to solve the simultaneous system of two equation to get the daily data of variables va and siga (given the initial values va_init and siga_init).
a = {va} * normal((log({va}/c)+(b+0.5*({siga}^2)))/ {siga}) -c* exp(-(b))* normal(((log({va}/c)+(d+0.5*({siga}^2)))/ {siga})-{siga})
d = ({va}/a)* normal((log({va}/c)+(b+0.5*({siga}^2)))/ {siga})*{siga}
I'm using -nlsur in stata to get them, but for some reason the formula cannot calculate these value for each observation (which is needed here), but only for the group.
Here is the formula I use:
nlsur (a = {va} * normal((log({va}/c)+(b+0.5*({siga}^2)))/ {siga}) -c* exp(-(b))* normal(((log({va}/c)+(d+0.5*({siga}^2)))/ {siga})-{siga})) (d = ({va}/a)* normal((log({va}/c)+(b+0.5*({siga}^2)))/ {siga})*{siga}), initial(va va_init[_n] siga siga_init[_n])
If I try to calculate it the following way:
by one, sort: nlsur (a = {va} * normal((log({va}/c)+(b+0.5*({siga}^2)))/ {siga}) -c* exp(-(b))* normal(((log({va}/c)+(d+0.5*({siga}^2)))/ {siga})-{siga})) (d = ({va}/a)* normal((log({va}/c)+(b+0.5*({siga}^2)))/ {siga})*{siga}), initial(va va_init[_n] siga siga_init[_n])
--> I get the error: cannot have fewer observations than parameters
But this is exactly what I need to calculate:
Does anyone know the solution for my problem?
I also attach the example file, so that you can try it.
Comment