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 22:01:28 +0100

Let`s try the exponential distribution...

***********
sysuse auto, clear
cap ssc inst rnd
rndexp `c(N)' 3
g weightstoc= weight+100*xe
***********

-drawnorm- draws from a multivariate normal, which you presumably do not want/need...




HTH
Martin
_______________________
----- Original Message ----- From: "Linn Renée Naper" <linn.naper@ecgroup.no>
To: <statalist@hsphsun2.harvard.edu>
Sent: Monday, November 10, 2008 9:35 PM
Subject: RE: st: RE: Manipulation of the distribution


Hi again

1) In your car-example below, what about adding a stochastic element with another probability distribution? Is that straight-forward as well?

2) Will using the drawnorm-command in stata serve the same purpose (after adding the "draws" to the old weight) of adding a stochastic element as the trick using invnorm(uniform())?

Linn
-----Opprinnelig melding-----
Fra: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] På vegne av Martin Weiss
Sendt: 10. november 2008 17:54
Til: statalist@hsphsun2.harvard.edu
Emne: RE: st: RE: Manipulation of the distribution

Although I did not use it in my own example...


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 5:45 PM
To: statalist@hsphsun2.harvard.edu
Subject: RE: st: RE: Manipulation of the distribution

Thanks Martin,
Your simple "nutshell" explanation helped!

-----Opprinnelig melding-----
Fra: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] På vegne av Martin Weiss
Sendt: 10. november 2008 16:27
Til: statalist@hsphsun2.harvard.edu
Emne: RE: st: RE: Manipulation of the distribution

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/

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



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