Announcement

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

  • Add more observations of a database

    Hi Stata community!
    I have a database of 400 observations and I want to randomize it to 8,000 observations, for all variables.

    Thanks for any help!

  • #2
    It is not at all clear what you have and what you want to do, precisely. Please do read the FAQ and pay special attention to Section 12. A reproducible data example and a concrete description of what you want should be included. People here may be willing to help, but only if they feel they can, and that can only happen if you help us to help you.

    Comment


    • #3
      Uhhh sounds like you're looking for the expand command, but without further detail I've no idea what it is you really want.

      Comment


      • #4
        Interested as well, in particular, I need to create a random sample of one group of countries (sample size=971, need the sample of 1500), estimate probit model and store y hats. And this should be repeated at 100 times.

        Would appreciate any help!

        Comment


        • #5
          Originally posted by Farogat WIUT View Post
          Interested as well, in particular, I need to create a random sample of one group of countries (sample size=971, need the sample of 1500), estimate probit model and store y hats. And this should be repeated at 100 times.

          Would appreciate any help!
          You should create a new thread to ask your question. It is considered rude to hijack someone else's question, especially if their question has not been adequately addressed. As you are asked in the FAQ, please provided in that thread a reproducible data example (e.g., using -dataex-) and a clear description of what you want to do. At a guess, you want -gsample- for the sampling, and -predict- immediately following your -probit- model.

          Comment


          • #6
            The following example demonstrates how to randomly select observations, with replacement, with no limit on whether more or fewer observations are to be selected than exist in the original dataset. It is based on an example that Clyde Schechter posted in another, rather lengthy discussion, here.
            Code:
            // make a copy of the data including an observation number
            sysuse auto, clear
            generate obs_num = _n
            save auto, replace
            
            // how many observations are wanted
            local newN = 300
            
            // how many observations are there?
            quietly describe using auto
            local oldN = r(N)
            
            display "sampling `newN' observations from `oldN' observations"
            
            // create random list of observations to use
            set seed 666 // set a seed to ensure replicability of random draw
            clear
            set obs `newN'
            generate obs_num = runiformint(1,`oldN')
            
            // add the data
            merge m:1 obs_num using auto, keep(match) nogenerate

            Comment


            • #7
              Originally posted by Leonardo Guizzetti View Post

              You should create a new thread to ask your question. It is considered rude to hijack someone else's question, especially if their question has not been adequately addressed. As you are asked in the FAQ, please provided in that thread a reproducible data example (e.g., using -dataex-) and a clear description of what you want to do. At a guess, you want -gsample- for the sampling, and -predict- immediately following your -probit- model.
              Sorry and thanks!!

              Comment

              Working...
              X