Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: nl command with restriction


From   "E. Paul Wileyto" <[email protected]>
To   [email protected]
Subject   Re: st: nl command with restriction
Date   Tue, 12 Feb 2008 08:09:08 -0500

Puzzled because your starting values don't add to 1 (a+b+c). (If A+B+C add to 1, then you really are only estimating A & B.) But if you do what I suggest, then the estimates you get back will not initially add to 1. You must transform them back.
If I read your function correctly:

replace `1' = $a*((k^$b)*(l^$c)*(n^(1-$b-$c)))


replace $a in the expression with exp($a)/(1+exp($a) +exp($b))

replace $b with exp($b)/(1+exp($a) +exp($b))

replace $c with 1/(1+exp($a) +exp($b))

a, b, and c will come back with estimates from - to + infinity.

Then use nlcom to get back your parameter estimates:

nlcom (A: exp(_b[a])/(1+exp(_b[a]) +exp(_b[b]))) (B: exp(_b[b])/(1+exp(_b[a]) +exp(_b[b]))) (C: 1/(1+exp(_b[a]) +exp(_b[b])))

Paul





Rodolfo Coelho Prates wrote:

Thanks Paul and Nick!

I tried implement yours sugestions, but I think my comprehention is not
correct.

I estimeted the Cobb-Doulas with three variables, like this:

program define nlces12
version 8.0
if "`1'" == "?" {
global S_1 "a b c"
global a=.15
global b=.4
global c=.3
global S_2 "Cobb-Douglas with additive error"
exit
}


replace `1' = $a*((k^$b)*(l^$c)*(n^(1-$b-$c)))


end

This routine works well, but has that problem.

If I understood, the suggestion is:



replace `1' =
$a*((k^(exp($b)/(1+exp($b)+exp($c))))*(l^(exp($c)/(1+exp($b)+exp($c))))*(n^(1/(1+exp($b)+exp($c)))))





Thise are the estimations with brute force:

Source | SS df MS Number of obs = 123
-------------+------------------------------ F( 2, 121) = 102.83
Model | 8.2419e+09 2 4.1209e+09 Prob > F = 0.0000
Residual | 4.8489e+09 121 40073949.1 R-squared = 0.6296
-------------+------------------------------ Adj R-squared = 0.6235
Total | 1.3091e+10 123 106429266 Root MSE = 6330.399
Res. dev. = 2500.31
Cobb Douglas with aditive error
---------------------------------------------------------------------------
y | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+-------------------------------------------------------------
a | 2.594492 .3699407 7.01 0.000 1.862096 3.326887
b | 17.12698 .3519304 48.67 0.000 16.43025 17.82372
c | 16.97066 . . . . .
------------------------------------------------------------------------------

Works well, but the sum of coeficients are larger than one, but not
negatives. Do I need realize a transformation? Or did I made something
wrong?

Best Regards,

Rodolfo


*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/

--
E. Paul Wileyto, Ph.D.
Assistant Professor of Biostatistics
Tobacco Use Research Center
School of Medicine, U. of Pennsylvania
3535 Market Street, Suite 4100
Philadelphia, PA 19104-3309

215-746-7147
Fax: 215-746-7140
[email protected]
http://mail.med.upenn.edu/~epw/
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index