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

From |
Bob Hammond <robert_hammond@ncsu.edu> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: Possible bug with Mata binomialp and variable argument |

Date |
Tue, 03 Feb 2009 16:29:27 -0500 |

All,

mata: binomialp(3,2,0.25) works fine but: mata: binomialp(n,2,0.25)

Thanks, Bob Works: >>>>>>>>>>>>>>>>>>>>>>> clear set obs 10 gen byte n = 2 + int(5*runiform()) gen double x = . cap mata: mata drop myfunc() *the following requires moremata to be installed (findit moremata) mata:

for(i=1;i<=10;i++) { st_view(n = .,i,"n") mm_root(x = .,&myfunc(),0,1,0,1000,n) st_store(i,"x",x) } end list >>>>>>>>>>>>>>>>>>>>>>> Does not work: >>>>>>>>>>>>>>>>>>>>>>> clear set obs 10 gen byte n = 2 + int(5*runiform()) gen double x = . cap mata: mata drop myfunc() *the following requires moremata to be installed (findit moremata) mata: function myfunc(x,n) return( x^2 - binomialp(n,2,0.25)) for(i=1;i<=10;i++) { st_view(n = .,i,"n") mm_root(x = .,&myfunc(),0,1,0,1000,n) st_store(i,"x",x) } end list >>>>>>>>>>>>>>>>>>>>>>> -- ------------------------------------------------------------------------ Bob Hammond Department of Economics North Carolina State University Office: (919) 513-2871 Fax: (919) 515-7873 http://www4.ncsu.edu/~rghammon/ * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

- Prev by Date:
**Re: st: count regression with product & power terms** - Next by Date:
**Re: st: eliminate blank marginal space with - graph, aspectratio(1) -** - Previous by thread:
**st: New package -diptest- available from SSC for assessing modality** - Next by thread:
**Re: st: Possible bug with Mata binomialp and variable argument** - Index(es):

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