Date: Sat, 3 Dec 2005 13:50:49 -0500
Reply-To: "Richard A. DeVenezia" <rdevenezia@WILDBLUE.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Richard A. DeVenezia" <rdevenezia@WILDBLUE.NET>
Subject: Re: Anyone knows how to use sas to do "buffon's needle
experiment"?
Barry wrote:
> I am try to create a SAS macro that generates M observations (of size
> n each, i.e., throw the
> needle n times) of the estimated values of . The macro assumes the
> following parameters:
> · seed, the random seed;
> · size, the sample size n;
> · obs, the simulation size M;
> · data, output data set name;
> · method=Buffon (default) or Laplace, for one of the methods as
> described above.
> The output data set (M observations) should contains the estimates of
> .
> Use the macro, with the fixed n = 100 (or larger) and fixed M = 1000
> (or larger), generate
> two data sets, one with Buffon's and one with Laplace's. Combine
> these data sets into one final
> data set and use it
> 1. to generate two plots using PROC GPLOT:
> · one with the super-imposed time series plot of the two series of
> estimates and with the
> horizontal reference line at pi = 3.141593 (i.e., each series of
> estimates plotted
> against simulation numbers 1, 2, · · · ,M);
> · one with super-imposed of two series each (for each method) formed
> by the deviations
> from target value (i.e. deviation = estimate - pi) with horizontal
> reference line at 0;
> 2. to produce histograms (a 2-panel plot with identical horizontal
> scale) for the two series of
> estimates using PROC CHART;
> 3. to produce a summary of the simulation results containing the
> following:
> (a) n, the sample size;
> (b) M, the simulation size;
> (c) mean of estimates from Buffon's;
> (d) variance of estimates from Buffon's;
> (e) mean of estimates from Laplace's;
> (f) variance of estimates from Laplace's.
> Discuss the outcomes.
> 3
Don't really need a macro.
You won't learn much about the rest unless you do it yourself.
--
Richard A. DeVenezia
http://www.devenezia.com/
|