Announcement

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

  • Simulate correlated binary variables

    Hi,

    I would like to simulate correlated binary variables.

    Theoretically, I should have been able to do the simulation from the following paper

    https://journals.sagepub.com/doi/pdf...867X1501500118

    and use the command proposed in the aforementioned paper

    rbinary

    Unfortunately, this command does not work. I get an error message

    file "rbinary_simudata.dta" not found
    r(601);




    Do you have any suggestions? How can I overcome the problem of this command? Or, do you have any recommendation of an alternative way to simulate correlated binary variables?

    Many Thanks,
    Michalis



  • #2
    It's a user-written command, not part of official Stata, and can be quickly installed in Stata. This is one of the important features of Stata, that one can install such commands. They then will be available to you to use. Type -search binary- at your command line, and then click on the link to install the command. Then, you can type -help rbinary- to learn how to use it.

    Comment


    • #3
      Yes, that's exactly what I did. I installed the command rbinary, as you mentioned.


      Unfortunately, when I run the example from the help file


      rbinary x1 x2 x3 x4, means(0.05,0.10,0.15,0.20) corr(1,.3,.2,.1\.3,1,.3,.2\.2,.3,1,.3\.1,.2,.3,1) n(2000) seed(12345)


      I get the error message I mentioned in my initial e-mail, i.e.

      file "rbinary_simudata.dta" not found
      r(601);



      I am not sure how to deal with this problem.

      Any suggestion? Or any alternative way to deal with the simulate correlated binary variables?

      Thanks,
      Michalis

      Comment


      • #4
        I have no idea what this command does, however one possibility is the following:
        is the .dta file you downloaded in the correct directory you invoke when executing the command?

        Comment


        • #5
          The rbinary_simudata.dta is an ancillary file and has to be download (-net get-) separately from the program files.

          Comment


          • #6
            Hi,

            The problem is that I cannot download the ancillary files.
            I tried the net get command, but still I get an error.

            As a result, I cannot run the examples described in the help file.

            I would very much appreciate any recommendation or any alternative way to simulate correlated binary variables.

            Thanks,
            Michalis

            Comment


            • #7
              Run this command:
              Code:
              findit rbinary
              Next, the help window search for rbinary will open.
              Then, click on the first listed item link st0382,
              That opens the package window that allows for the downloading of the INSTALLATION FILES by means of a mouse click event on (click here to install),
              and the ANCILLARY FILES by means of a mouse click event on (click here to get).
              Note that the ancillary files will be downloaded in your current working directory (folder), which might be any place.

              To change to a working directory (folder) of your choice, first, run this command:
              Code:
              cd "C:\MyMainFolder\MySubjectFolder"
              pwd // to check if all is well
              http://publicationslist.org/eric.melse

              Comment


              • #8
                Hi,

                The problem is that cannot get the ancillary files.
                When I click at the point "(click here to get)"

                then I get the following message


                Click image for larger version

Name:	error message.PNG
Views:	1
Size:	49.3 KB
ID:	1561217

                Comment


                • #9
                  The fact that you get the message 'the following files already exist and are different: examples.do' implies that the ancillary files are downloaded and Stata saves it in your current working folder.
                  You have to check what that folder is by entering the command:
                  Code:
                  pwd
                  Next, you should use your Windows Explorer and visit that folder. Is the file [rbinary_simudata.dta] stored there?
                  I also expect there the file [examples.do] because of the error message.
                  Is it possible that you either have downloaded these files before, or that you are saving to a folder with another [examples.do] file?
                  In the last case, rename it.
                  http://publicationslist.org/eric.melse

                  Comment


                  • #10
                    Now it works! Thanks a lot!

                    Michalis

                    Comment

                    Working...
                    X