Gary King Homepage Previous: How do I know Up: Frequently Asked Questions Next: How can I set

How can I set the X's equal to the actual values in my dataset?

You can use the setx command to set the x's at any value you'd like, including the actual values that appear in the dataset. For instance, setx [93] will set all the x's equal to the values that appear in the 93rd observation of your dataset. The sequence of commands
     setx mean                /* sets all x's to their means */
     setx x1 x1[7]            /* resets x1 to value in 7th observation */
will set all the x's equal to their means, and then set x1 equal to the value of x1 that appears in the 7th observation of the dataset. If you wanted to get results for each x1 in your dataset, you could write a little loop, such as:
     setx mean                /* set all x's to their mean levels */
     local i 1                /* create a counter that runs from 1 to */
     while `i' <= _N {        /*   _N, where _N is the # of observations */
         setx x1 x1[`i']      /* set x1 to the value in the ith obs */
         simqi                /* simulate quantity of interest */
         local i = `i' + 1    /* repeat for other observations */
     }



Gary King 2006-01-04