Date: Thu, 10 Nov 2005 12:03:19 -0500
Reply-To: Talbot Michael Katz <topkatz@MSN.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Talbot Michael Katz <topkatz@MSN.COM>
Subject: Re: Monte-carlo simulation with conditional draws....
OOPS!
Slight error in the first line I gave you. Change "R*R" to "RHP*RHP" :
Z=(RHP*X)+(SQRT(1-(RHP*RHP))*Y);
Sorry!
-- TMK --
"The Macro Klutz"
On Thu, 10 Nov 2005 11:51:58 -0500, Talbot Michael Katz <topkatz@MSN.COM>
wrote:
>Hi, Pete.
>
>For normal random variables, linear combinations are still normal.
>Suppose that RHP is the correlation between HIGHTEMP and PRECIP.
>
>Then modify your code as follows:
>
>Z=(RHP*X)+(SQRT(1-(R*R))*Y);
>PRECIP=PRECIP_MEAN+sqrt(PRECIP_VARIANCE)*Z;
>
>
>Now HIGHTEMP and PRECIP should have the correlation you desire.
>
>
>As for modeling, this looks like a job for PROC MIXED; from the online
doc:
>
>"The primary assumptions underlying the analyses performed by PROC MIXED
>are as follows:
>
>"The data are normally distributed (Gaussian).
>"The means (expected values) of the data are linear in terms of a certain
>set of parameters.
>"The variances and covariances of the data are in terms of a different set
>of parameters, and they exhibit a structure matching one of those
>available in PROC MIXED.
>"Since Gaussian data can be modeled entirely in terms of their means and
>variances/covariances, the two sets of parameters in a mixed linear model
>actually specify the complete probability distribution of the data. The
>parameters of the mean model are referred to as fixed-effects parameters,
>and the parameters of the variance-covariance model are referred to as
>covariance parameters. "
>
>
>Of course, three or more covariates follow the same principles, but with
>additional combinatorial complexity.
>
>Good luck!
>
>
>-- TMK --
>"The Macro Klutz"
>
>
>On Thu, 10 Nov 2005 10:51:12 -0500, Peter Larsen <phlarsen@YAHOO.COM>
>wrote:
>
>>Hi SASHeads-
>>
>>I recently built an economic model with four measures of weather (precip
>>total, precip deviation, low temp, and high temp) used as inputs to the
>>model. I have parameter estimates for all of my variables (including the
>>four weather measures) that were generated from an OLS performed on the
>>data.
>>
>>Lately, I have been experimenting with running a monte-carlo simulation
in
>>SAS that takes hundreds/thousands of random draws from a normal
>>distribution with a mean and std. error calculated from the raw weather
>>data. Currently, the code is drawing the iterations of each weather
>>variable independently and sticking them into the equation estimated from
>>the OLS to produce a distribution of economic output. In other words,
>>high temp is drawn independent of the draw of total precipitation.
>>Obviously, temperature and precip are often correlated so the above
method
>>is producing unrealistic weather scenarios for my economic model.
>>
>>My question is this: How would someone design a MC simulation in SAS that
>>is conditional on the value obtained from a previous draw? Also, what
>>sort of modeling, correlation matrix, etc. is needed to
>>determine "realistic" combinations of weather based on the conditional
>>drawing technique posed above?
>>
>>My code for the draws looks like this (truncated):
>>
>>DATA TEMP;
>>SET TEMP;
>>DO I=1 to 100;
>>X=RANNOR(10);
>>Y=RANNOR(11);
>>HIGHTEMP=HIGHTEMP_MEAN+sqrt(HIGHTEMP_VARIANCE)*X;
>>PRECIP=PRECIP_MEAN+sqrt(PRECIP_VARIANCE)*Y;
>>OUTPUT;
>>END;
>>RUN;
>>
>>Thanks in advance for your help. You guys/gals rock!
>>
>>Pete
|