Statalist


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

st: mata (simple): generating random numbers


From   "Feiveson, Alan H. (JSC-SK311)" <alan.h.feiveson@nasa.gov>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: mata (simple): generating random numbers
Date   Thu, 1 Nov 2007 14:47:14 -0500

Hi -I've been frustrated by trying to simply generate random uniforms
using uniform()in Mata: Here's what happens:

. mata
------------------------------------------------- mata (type end to
exit) ---------------------------
: A = 1..5

: E=exp(A)

: A
       1   2   3   4   5
    +---------------------+
  1 |  1   2   3   4   5  |
    +---------------------+

: E
                 1             2             3             4
5
 
+-----------------------------------------------------------------------
+
  1 |  2.718281828   7.389056099   20.08553692   54.59815003
148.4131591  |
 
+-----------------------------------------------------------------------
+

: F=normal(A)

: F
                 1             2             3             4
5
 
+-----------------------------------------------------------------------
+
  1 |  .8413447461   .9772498681    .998650102   .9999683288
.9999997133  |
 
+-----------------------------------------------------------------------
+

: U=uniform()
wrong number of arguments for uniform()
r(3000);

: U=uniform():*1
wrong number of arguments for uniform()
r(3000);

: U=uniform():*A
wrong number of arguments for uniform()
r(3000);

What am I doing wrong? Also, nowhere in the Mata manuals can I find
anything about what arguments the statistical functions take. After
going to interactive  "help', I finally found out they were the same as
the Stata function arguments. So if that's true, why doesn't "uniform()"
work?

Al Feiveson

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index