Statalist


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

RE: st: RE: Manipulation of the distribution


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: RE: Manipulation of the distribution
Date   Mon, 10 Nov 2008 16:26:36 +0100

For the -set seed- issue, see, e.g. -help generate-. It allows you, to put
it in a nutshell, to reproduce your research later on even though there is a
"stochastic element" in it. If I want to add such an element to the weight
of very old cars under Stata 10.0, and hopefully 9.x, I go


********
sysuse auto, clear
g weightstoc= weight+100*invnormal(uniform())
*let`s see...
tw (scatter weight weightstoc) ( function y=x, range(0 5000))
********


HTH
Martin


-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Linn Renée Naper
Sent: Monday, November 10, 2008 4:06 PM
To: statalist@hsphsun2.harvard.edu
Subject: RE: st: RE: Manipulation of the distribution

Thanks
I don't know what happened to the formatting (sending from a
hotmail-account, a meant to send in plain text-format). I'm trying ones more
using a another email-account...

Maybe, I can reformulate my problem a little. What I actually are trying to
do is to manipulate hourly electricity prices by adding a stochastic
element. Like "price + u". The element u should have a given distribution -
so that's way I need to generate a new variable with a given mean and
standard deviation. Therefor I am trying to learn more one how Stata
actually define new random variables.
What does the "set seed" option in invnorm actually do?
Next, I will add this element to the price at random. The prices can be
grouped in different ways, by day, week etc. I aim at doing different
manipulations, for example increasing the sd of the daily prices by a given
factor, but let it be random which prices are decreased and increased. I
could also let it be random how large the daily increase is for different
weeks. Important here is thus that all prices are identified by weekday,
weeknumber and year.
Is there a good way to imply a new "shape" to an already excisting
distribution of prices. For example if you have a prices with kernel density
with "one peak", and you like to change the distribution so that is has "two
peaks".

Hard to figure out your email in my Outlook (weird formatting, of the code
in particular). You want to look at 

-ssc d rnd-
-h sample-

the former because you run Stata9: Stata 10.1 now comes with built-in random
number functionality. 

BTW, -ret list- is very much unnecessary in a loop. This command just serves
to acquaint you with the return list, but is of no use in the loop...


HTH
Martin

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index