Bookmark and Share

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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: sb command + ereturn matrix


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: sb command + ereturn matrix
Date   Thu, 12 Jan 2012 13:39:12 +0000

"cannot" is an absolute and does not match what I said exactly. But I
do advise against it for what I understand of your problem.

Nick

On Thu, Jan 12, 2012 at 1:29 PM, michela bia <michela.bia@ceps.lu> wrote:
> Ok!
> Thanks a lot Nick.
>
> So, I cannot use the bootstrap in this way.
>
> I will try to fix it.
>
>
> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox
> Sent: Thursday, January 12, 2012 2:18 PM
> To: statalist@hsphsun2.harvard.edu
> Subject: Re: st: sb command + ereturn matrix
>
> I have very limited grasp of what you are trying to do, but as a
> general strategic point it is difficult to see a case for ever wanting
> to call -bootstrap- within a program (do-file, yes). -bootstrap-
> potentially leaves lots of results, and then there is a collision
> between its results and the results of your own program. Rather, have
> your program save results, which you then -bootstrap- Of course you
> can't -bootstrap- a matrix, which poses separate questions.
>
> An even more general point is that it is best to write a program to do
> one thing well, if only because a program that does everything you
> want can be very much more difficult ever to get working.
>
> More specifically, you write
>
> "please note that they are saved in the local `DRFps' if I write mat
> li `DRFps'!!)"
>
> This is, or seems, very confused. -matrix list- just displays results,
> and saves nothing. Also, the local macro referred to is just holding a
> name for that matrix, and that local necessarily disappears at the end
> of the program. Either way, there is no saving in that statement.
>
> I can't follow the rest of your specific questions, but I suspect
> -bootstrap- has just stomped on stuff you created earlier.
>
> Nick
>
> On Thu, Jan 12, 2012 at 12:47 PM, michela bia <michela.bia@ceps.lu> wrote:
>> Dear all,
>> I wrote an e-class program applying the radial penalized spline methodology and saving the estimates in a matrix (ereturn matrix command).
>> I also made the bootstrap of standard errors, but the estimates don't seem to be saved in the matrix when I run the bs command
>> (please note that they are saved in the local `DRFps' if I write mat li `DRFps'!!).
>>
>> The error message is: statistic matrix(r(DRFps)) evaluated to missing in full sample
>> if I save the estimates writing : mat def DRFps = `DRFps'
>>
>> and it is: DRFps not found
>> if I write:  ereturn matrix DRFps = `DRFps'
>>
>> May you please help me?
>> How can I save the results in the correct way using the bootstrap at the end of the code?
>>
>> program define DRF, eclass
>> version 11
>>
>> ...
>> mat li `DRFps'
>>
>> _00006C[1,10]
>>           c1         c2         c3         c4         c5         c6         c7         c8         c9
>> r1  17349.756  13332.923  11062.302  9614.0808  8676.7353  8095.0012  7776.8476  7664.3185  7708.5554
>>
>>          c10
>> r1  7883.4903
>>
>> ereturn matrix DRFps = `DRFps'
>>
>> if("`method'" == "radialpspline"){
>>
>> bs "DRF `varlist' `if' `in', outcome(`outcome') treatment(`treatment') gpscore(`gpscore') dose(`dose') method(`method') family(`family') link(`link') vce(`vce') common(`common') numoverlap(`numoverlap') tpoints(`tpoints') npoints(`npoints') npercentiles(`npercentiles') `derivative' nknots(`nknots') knots(`knots') `standardized' estopts(`estopts')" DRFps=matrix(r(DRFps)), nowarn `options'
>>
>> }
>>
>> End
>>
>>
>> BTW - Reference:  'Semiparametric Regression', David Ruppert, M. P. Wand, R. J. Carroll July 2003
>
> *
> *   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/

*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index