| Date: | Wed, 26 Jan 2011 12:24:12 -0800 |
| Reply-To: | Dale McLerran <stringplayer_2@YAHOO.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Dale McLerran <stringplayer_2@YAHOO.COM> |
| Subject: | Re: Outputting parameter estimates in NLMIXED |
| In-Reply-To: | <AANLkTik8G_BSEZsHZWShO1H5d_v2D1RnMMR5yX+K7Ped@mail.gmail.com> |
| Content-Type: | text/plain; charset=iso-8859-1 |
The problem here is that parameter estimates from a prior
successful procedure run are not being overwritten when the
NLMIXED code fails to converge. Rather than creating a copy of
the output data set prior to executing NLMIXED in which parameter
estimates are initialized with some null value, I would delete
the file which contains the parameter estimates after appending
the parameter estimates to the master file.
Thus, I would structure code something like the following:
%macro mysim(...); /* ... indicates macro parameter specification */
... /* ... indicates any macro processing steps */
/* that are performed prior to iterations */
/* in which data are generated and the */
/* NLMIXED procedure is executed. */
%do iter=1 %to 1000;
<simulated data generation>
/* execute NLMIXED against simulated data */
ods output ParameterEstimates=Parms_iter;
proc nlmixed data=sim;
... /* ... NLMIXED code for fitting the model */
run;
/* Test for existence of Parms_iter. Existence implies */
/* successful completion of the NLMIXED procedure. If */
/* the file exists, attach the current iteration number */
/* to the file, append the file to the master results */
/* file, and then delete the current iteration results. */
/* */
/* If the file does not exist, we just go on to the */
/* next iteration. */
%if %sysfunc(exist(Parms_iter)) %then %do;
data parms_iter;
retain iteration &iter;
set parms_iter;
run;
proc append base=Parms data=Parms_iter;
run;
proc datasets;
delete Parms_iter;
quit;
%end;
...
%mend;
Dale
---------------------------------------
Dale McLerran
Fred Hutchinson Cancer Research Center
mailto: dmclerra@nFoHsCpRaCm.org
Ph: (206) 667-2926
Fax: (206) 667-7004
---------------------------------------
--- On Wed, 1/26/11, Data _null_; <iebupdte@GMAIL.COM> wrote:
> From: Data _null_; <iebupdte@GMAIL.COM>
> Subject: Re: Outputting parameter estimates in NLMIXED
> To: SAS-L@LISTSERV.UGA.EDU
> Date: Wednesday, January 26, 2011, 9:44 AM
> Before each call to NLMIXED create
> the data set that is expected.
> Make it with 0 obs and variables. Then the SET should
> work but not
> pick up the wrong data.
>
> On Wed, Jan 26, 2011 at 11:33 AM, SUBSCRIBE SAS-L
> Ameribrit
> <FRP3@pitt.edu>
> wrote:
> > HI Guys:
> > Is there any way in the ods output statement to only
> tell NLMIXED to
> > output the file if the procedure converges?
> >
> > I am trying to accumulate all the estimates from a
> simulation
> > by using the set statement on the previous output. But
> what I think is
> > happening is if NLMIXED fails with "no valid parameter
> points found' the
> > output file is not created then I set the output file
> on this iteration
> > (which now dosnt exist) with the output file from an
> iteration which did
> > run and I end up with a run of identical parameter
> estimates.This makes it
> > look like I am running the proc on the same data set
> and that the
> > randomness is not present.
> >
> > So is there a better way to output results from a proc
> and append to the
> > output file only if the proc converges and has results
> to output?
> >
> > thanks
> > Francis
> >
>
|