Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Looking for command (name): generates a dataset with given mean and standard deviation but not rnormal() (not for simulation)

    Dear all
    I know that there is a command in Stata that generates a dataset with given mean and standard deviation. I do not want to simulate datasets but I want a dataset with a given mean and standard deviation (so I can use commands that require individual observations but do not work with summary level data). Anybody who knows the name of the command (I googled and checked the manual but could not find it)?
    Any help is appreciated.
    Best
    Sven

  • #2
    I may well be misunderstanding, but I don't see how this can be done. Mean and SD don't characterise datasets uniquely. Here is a simple demonstration . My mean is 42 and my SD is 666. Tell me what the dataset is.

    Comment


    • #3
      Sorry, I forgot: the size of the sample is also given.

      Comment


      • #4
        Same comments from me. My sample size is 17, or 2 million. How do you propose to generate the dataset?

        I am not hostile here, just not clear that you have a soluble problem, given the disclaimer that you don't want to simulate or call up a normal random deviate generator.
        Last edited by Nick Cox; 05 Apr 2016, 14:02.

        Comment


        • #5
          I have no clue that is why I hope more bright people than me work(ed) on this :-)
          Maybe I remember incorrectly and such a command is not possible and I made this up ... What I (think I) remember is that the help/documentation explicitly mentions that the generated dataset per se is useless because the individual observations are not 'valid' but only the dataset as a whole because it has the specified summary characteristics.
          But it seems that I am mistaken here ...

          Best
          Sven

          Comment


          • #6
            There is the program -drawnorm-, might that be what you are looking for?
            Stata/MP 14.1 (64-bit x86-64)
            Revision 19 May 2016
            Win 8.1

            Comment


            • #7
              I found it: it is the corr2data command!
              The trick is that the command allows for generating correlated datasets (2 variables) but also the generation of a single variable (where you only specify the mean and sds option). I contacted Tech Support to find out.
              Thanks everybody, problem solved for me. Sven

              Comment


              • #8
                Pleased it's what you are looking for, but the extra assumption is that data are Gaussian (normal), which you seemed to say at the outset that you didn't want to assume. And what is done inside is generation of random normal deviates. In other words, it really is a simulation and that's unavoidable.

                Otherwise put, this was why I was mystified by your question, and why it remains true that the problem is not soluble without some extra assumption, and then not soluble uniquely.
                Last edited by Nick Cox; 06 Apr 2016, 17:15.

                Comment

                Working...
                X