[Limdep Nlogit List] bootstrap LCM
Bos J.W.B.
jwb_bos at yahoo.com
Wed Mar 20 05:17:04 AEDT 2019
Thanks Bill!
> On Mar 19, 2019, at 6:35 PM, William Greene via Limdep <limdep at mailman.sydney.edu.au> wrote:
>
> Hi Jaap. There are several reasons I suspect this won't work. First, you
> can't concatenate
> a number onto a character string and obtain a character string. So,
> calc;i=2$ then "i.csv" does
> not produce the character string "2.csv". Second, if it did work, your
> program below just imports
> 1.csv over and over again. The calc;i=1$ should be before the DO
> statement. BUT, I think you
> should just be using PROC$ ... ENDPROC$ EXECUTE... for this construction,
> not DO. Do you
> really have 1,000 data files. There must be an easier way to do this. If
> you had all that data
> stacked in a single file, you could import the whole thing once, than use
> SAMPLE;...$ inside a
> procedure to control which observations to be using. This would also
> obviate creating 1,000
> output files, which will also be a pain in the neck. One last point.
> notwithstanding everything else,
> it looks like you don't have the full path to the import files in the
> command, so even if everything
> else did work, your program would probably not find the data files.
> Cheers
> Bill
>
> On Tue, Mar 19, 2019 at 12:10 PM Bos J.W.B. via Limdep <
> limdep at mailman.sydney.edu.au> wrote:
>
>> Hi Bill,
>>
>> Thanks! Very helpful indeed!!!
>>
>> A related question…. Am trying to write a procedure that would allow me to
>> run the same model on a large number of data sets. I have in mind the
>> following:
>>
>> proc
>> do for;i=1,1000$
>> calc;i=1$
>> IMPORT;FILE="i.csv"$
>> regress;lhs=y;rhs=one,x$
>> EXPORT;FILE="output_i.csv"
>> calc;i+1$
>> enddo$
>> endproc
>>
>> execute
>>
>> I cannot figure out how to get the import and export to work. Is it
>> possible at all?
>>
>> gr, Jaap
>>
>>> On Feb 19, 2019, at 10:19 PM, William Greene via Limdep <
>> limdep at mailman.sydney.edu.au> wrote:
>>>
>>> Jaap. In your regression spec in the procedure, you have RHS=one,x and
>>> LCM=x.
>>> This is surely overspecified - the same variables appear in the equation
>>> and in the
>>> class probabilities. In the specification of the model, you have
>> ;PDS=ni,
>>> which means
>>> that the class specification is the same from period 1 to period n1.
>> But,
>>> with ;LCM=x,
>>> you have the class probabilities changing over time. the result should
>> be
>>> unpredictablle.
>>> In fact, I believe that limdep is ignoring periods 2 - ni of X in
>> computing
>>> the class
>>> probabilities. But, again, the result seems to me like it might go awry.
>>> Also, shouldn't
>>> you be using a block bootstrap? Your data are a panel. You should have
>>> pds=ni in the
>>> EXEC command. Also, I don't think you want to repead
>>> CProb=Cprob;Group=Group;keep=fitopen
>>> 1,000 times. Do this with the original, non-bootstrapped regression.
>>> Finally, you might want
>>> to define BB to have 2*K cells.
>>> Best regards,
>>> Bill
>>>
>>> On Mon, Feb 18, 2019 at 8:59 AM Bos J.W.B. via Limdep <
>>> limdep at mailman.sydney.edu.au> wrote:
>>>
>>>> Dear all,
>>>>
>>>> I’m trying to bootstrap a latent class model. As a basis for my code, I
>>>> use the procedure described in the manual, section R15-3.
>>>>
>>>> Here’s my code:
>>>>
>>>> REGRESS;Lhs=klspe1;Rhs=one,klopen1,klopen1q,klywork$
>>>>
>>>> namelist;x=klopen1,klopen1q,klywork$
>>>> calc;k=col(x)$
>>>> matrix;bb=init(k,1,0.0)$
>>>> PROC
>>>> REGRESS;Lhs=klspe1;Rhs=one,klopen1,klopen1q,
>>>> klywork;LCM=X;Pds=ni;Pts=2;algs=bfgs;maxit=2000;
>>>> parameters;CProb=Cprob;Group=Group;keep=fitopen$
>>>> MATRIX;bb=b$
>>>> ENDPROC
>>>> EXEC;Bootstrap=bb;N=1000$
>>>>
>>>> The problem with this code is that it only bootstraps the coefficients
>> for
>>>> one class. Does anyone know the solution to this problem? I guess
>> modifying
>>>> the namelist command should do the trick, but I am not sure how….
>>>>
>>>> gr, Jaap Bos
>>>>
>>>> _______________________________________________
>>>> Limdep site list
>>>> Limdep at mailman.sydney.edu.au
>>>> http://limdep.itls.usyd.edu.au
>>>>
>>>
>>>
>>> --
>>> William Greene
>>> Department of Economics
>>> Stern School of Business, New York University
>>> 44 West 4 St., 7-90
>>> New York, NY, 10012
>>> URL: https://protect-au.mimecast.com/s/P0heC2xZYvCLqzx8hnWZ-r?domain=people.stern.nyu.edu
>>> Email: wgreene at stern.nyu.edu
>>> Ph. +1.212.998.0876
>>> Editor in Chief: Journal of Productivity Analysis
>>> Editor in Chief: Foundations and Trends in Econometrics
>>> Associate Editor: Economics Letters
>>> Associate Editor: Journal of Business and Economic Statistics
>>> Associate Editor: Journal of Choice Modeling
>>> _______________________________________________
>>> Limdep site list
>>> Limdep at mailman.sydney.edu.au
>>> http://limdep.itls.usyd.edu.au
>>>
>>
>> _______________________________________________
>> Limdep site list
>> Limdep at mailman.sydney.edu.au
>> http://limdep.itls.usyd.edu.au
>>
>>
>
> --
> William Greene
> Department of Economics
> Stern School of Business, New York University
> 44 West 4 St., 7-90
> New York, NY, 10012
> URL: https://protect-au.mimecast.com/s/P0heC2xZYvCLqzx8hnWZ-r?domain=people.stern.nyu.edu
> Email: wgreene at stern.nyu.edu
> Ph. +1.212.998.0876
> Editor in Chief: Journal of Productivity Analysis
> Editor in Chief: Foundations and Trends in Econometrics
> Associate Editor: Economics Letters
> Associate Editor: Journal of Business and Economic Statistics
> Associate Editor: Journal of Choice Modeling
> _______________________________________________
> Limdep site list
> Limdep at mailman.sydney.edu.au
> http://limdep.itls.usyd.edu.au
>
More information about the Limdep
mailing list