Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: Programming Stata

 From natasha agarwal <[email protected]> To [email protected] Subject Re: st: Programming Stata Date Wed, 17 Aug 2011 15:31:24 +0100

```Hi Austin,

I did what you mentioned but further down in the slides it is
mentioned 'can use heteroskedastic probit software provided the
response variable can be fractional' (Page 43) of the link you
mentioned (http://stata.com/meeting/chicago11/materials/chi11_wooldridge.pdf)

Thanks
Natasha

2011/8/17 natasha agarwal <[email protected]>:
> Below is the summary statistics for meap92_01.dta in the zip file
>
>
> . xtdescribe
>
>  distid:  1010, 2070, ..., 83070                            n =        501
>    year:  1992, 1993, ..., 2001                             T =         10
>           Delta(year) = 1 unit
>           Span(year)  = 10 periods
>           (distid*year uniquely identifies each observation)
>
> Distribution of T_i:   min      5%     25%       50%       75%     95%     max
>                        10      10      10        10        10      10      10
>
>     Freq.  Percent    Cum. |  Pattern
>  ---------------------------+------------
>      501    100.00  100.00 |  1111111111
>  ---------------------------+------------
>      501    100.00         |  XXXXXXXXXX
>
> Both are strongly balanced!
>
> William Greene in his book with David Hensher on 'Modelling Ordered
> Choices' state "Wooldridge proposes that αi be projected on all T
> vectors, xit rather than on just the means. The practical problem with
> this approach shows up in our application, in which there is an
> unbalanced panel. Simply filling in the missing years with zeros is
> not a satisfactory solution; zero is not an appropraite value for the
> regressor vector in a given year.)"
>
> Natasha
>
> On Wed, Aug 17, 2011 at 2:52 PM, natasha agarwal
> <[email protected]> wrote:
>>
>> This is the summary statistics for lfp.dta in the zip file link
>>
>>
>>
>>      id:  1, 2, ..., 5663                                   n =       5663
>>  period:  1, 2, ..., 5                                      T =          5
>>           Delta(period) = 1 unit
>>           Span(period)  = 5 periods
>>           (id*period uniquely identifies each observation)
>>
>> Distribution of T_i:   min      5%     25%       50%       75%     95%     max
>>                         5       5       5         5         5       5       5
>>
>>     Freq.  Percent    Cum. |  Pattern
>>  ---------------------------+---------
>>     5663    100.00  100.00 |  11111
>>  ---------------------------+---------
>>     5663    100.00         |  XXXXX
>>
>> And below is the summary statistics for meap
>>
>> On Wed, Aug 17, 2011 at 2:45 PM, natasha agarwal
>> <[email protected]> wrote:
>>> Yes!
>>>
>>> Search for 'unbalanced' in the link below
>>>
>>> http://www.cemmap.ac.uk/resources/imbens_wooldridge/lecture_6.pdf
>>>
>>> Natasha
>>>
>>>
>>>
>>> On Wed, Aug 17, 2011 at 1:12 PM, Austin Nichols <[email protected]> wrote:
>>>> natasha agarwal <[email protected]>
>>>> Seriously?
>>>> Search for "balanced" in the first link provided:
>>>> http://stata.com/meeting/chicago11/materials/chi11_wooldridge.pdf
>>>>
>>>> On Wed, Aug 17, 2011 at 5:57 AM, natasha agarwal
>>>> <[email protected]> wrote:
>>>>> Hi Austin,
>>>>>
>>>>> You are absolutely right. This has got to do with Woolridge's APE stuff.
>>>>>
>>>>> I had a look at the links you posted (thanks for that) and it has got
>>>>> me a little confused.
>>>>>
>>>>> Is the APE calculation meant only for balanced panel (as his data is balanced)?
>>>>>
>>>>> Thanks
>>>>> Natasha
>>>>>
>>>>>
>>>>>
>>>>> On Tue, Aug 16, 2011 at 3:57 PM, Austin Nichols <[email protected]> wrote:
>>>>>> natasha agarwal <[email protected]>:
>>>>>> I am guessing this is related to Wooldridge's APE stuff:
>>>>>> http://stata.com/meeting/chicago11/materials/chi11_wooldridge.pdf
>>>>>> http://ideas.repec.org/p/boc/nsug08/17.html
>>>>>> http://stata.com/meeting/snasug08/abstracts.html#wooldridge
>>>>>>
>>>>>> I have some programs from 2007 or 2008 to calculate the APE, but I
>>>>>> never released them, as I was working on a large-grain parallelized
>>>>>> bootstrap to speed up the SE calculations that I never finished.  I
>>>>>> guess I should revisit those programs, since there seems to be an
>>>>>> ongoing demand, but there is more than enough Stata code in
>>>>>> specific application.
>>>>>>
>>>>>> One thing--in your program below you put -xb- as an option to -gen-
>>>>>> when you mean -predict-.  Whenever you write a -program-, start by
>>>>>> running the commands interactively first, to debug your code.
>>>>>>
>>>>>> On Tue, Aug 16, 2011 at 10:17 AM, Nick Cox <[email protected]> wrote:
>>>>>>>
>>>>>>> 1. There is no obvious gain from writing this as a program.
>>>>>>> You might as well just run these commands in a do-file. Of course, this may be under development.
>>>>>>>
>>>>>>> 2. The line
>>>>>>>
>>>>>>> xtprobit expdum 'x', re
>>>>>>>
>>>>>>> will not work as the same character ' is used for both delimiters. You need
>>>>>>>
>>>>>>> xtprobit expdum `x', re
>>>>>>>
>>>>>>> Nick
>>>>>>> [email protected]
>>>>>>>
>>>>>>> Neil Shephard
>>>>>>>
>>>>>>> If you are going to write it as a program then you should save it as
>>>>>>> [filename].ado (not [filename].do as you are implying) and place it in
>>>>>>> one of your systems -adopath-'s (to see what these are simply type
>>>>>>>
>>>>>>> See [U] 16-18 for greater details on "Do-Files" (Chapter 16)
>>>>>>> "Ado-Files (Chapter 17) and "Programming Stata (Chapter 18).
>>>>>>>
>>>>>>> On 16 August 2011 13:41, natasha agarwal <[email protected]> wrote:
>>>>>>>
>>>>>>>> I am trying to write and run a program in Stata. The program I define
>>>>>>>> is as follows and I save it in the do-file
>>>>>>>>
>>>>>>>> capture program drop fdi
>>>>>>>> program fdi, rclass
>>>>>>>> local x " lnvfdi mfdi"
>>>>>>>> xtprobit expdum 'x', re
>>>>>>>> gen double x1b1hat, xb
>>>>>>>> gen double scale = normalden(x1bhat1)
>>>>>>>> gen double pe1=scale*_b[lnvfdi]
>>>>>>>> summarize pe1, meanonly
>>>>>>>> return scalar ape1=r(mean)
>>>>>>>> drop x1b1hat scale pe1
>>>>>>>> end
>>>>>>>>
>>>>>>>> When I type fdi, I get an error invalid file name.
>>>>>>>>
>>>>
>>>> *
>>>> *   For searches and help try:
>>>> *   http://www.stata.com/help.cgi?search
>>>> *   http://www.stata.com/support/statalist/faq
>>>> *   http://www.ats.ucla.edu/stat/stata/
>>>>
>>>
>>
>

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```