SHAZAM Questions and Answers (Q&A) - RSS feedhttp://community.econometrics.com/questions/SHAZAM Econometrics, Statistics and Analytics Communityen<font color="white">Copyright <b>SHAZAM Analytics, 2018</b></font>Tue, 30 Dec 2014 10:04:58 +0000Simulation of a distributionhttp://community.econometrics.com/question/584/simulation-of-a-distribution/Hi all – and Merry Christmas to all of you,
I have a question just in front of the turn of the year.
**Background**: I have two independent variables X and Y. The first two moments are as follows:
Average of X is = a and standard deviation is st.dev X = b. The average of Y is = c and st.dev Y = d. Let’s say the variables are normally distributed.
**Problem**: I’m interested in distribution of the product “Z” of the variables, i.e. the distribution of Z = XY. What is the average and the st.dev of Z and how can we visualize it?
**Question**: How can Shazam be applied in a Monte Carlo/bootstrapping – simulation of the distribution of Z? Is it possible to write a Shazam script that selects one number for X and Y from a sample size of for example 200 (optional). Then multiply the selected numbers XY = Z, and Shazam repeats the selection and multiplication for example 1000 times (optional). Calculate the first two moments of Z (average and variance (st.dev)). Then plot (graph) the frequency distribution of the 1000 numbers of Z (Z measured on the horizontal axis and frequency on the vertical axis).
Great if anyone could help writing a Shazam-script which solves the problem.
Regards,
P
PanteraTue, 30 Dec 2014 10:04:58 +0000http://community.econometrics.com/question/584/error message after running a "do" command in bootstrappinghttp://community.econometrics.com/question/486/error-message-after-running-a-do-command-in-bootstrapping/Hi all,
I have got some problem when computing standard deviations for metafrontier parameters, which I have estimated previously, through bootstrapping.
The error message starts after the do command and it says syntax error when generating variable. I appreciate your help. See the error message and the command that I have used below. Note that x*starb are previously estimated.
|_sample 1 556
|_matrix q = cowva
|_matrix qstar = x*starb
|_matrix e = q-qstar
|_dim beta 5 1000
|_set nodoecho
|_set nooutput
|_set ranfix
|_do #=1, 1000
|_gen newe = samp(e)*SQRT(N/(N-K))
|_sample 1 556
|_stat newe
|_gen qnew = qstar+newe
|_OLS qnew feed vet herd price / COEF=beta:4
|_endo
$
...ERROR..SYNTAX ERROR WHEN GENERATING VARIABLE
|_matrix bstre = newe'
$
...ERROR..SYNTAX ERROR WHEN GENERATING VARIABLE
|_matrix beta = beta'
|_set output
|_sample 1 1000
|_stat bstre
...ERROR..VARIABLE bstre DOES NOT EXIST.
|_sample 1 1000
|_stat beta
|_stop
The command I have used is :
dim cowva 556
read (cow.txt) cowva / beg=1 end=556 list
sample 1 556
matrix q = cowva
matrix qstar = x*starb
matrix e = q-qstar
dim beta 5 1000
set nodoecho
set nooutput
set ranfix
do #=1, 1000
gen newe = samp(e)*SQRT(N/(N-K))
sample 1 556
stat newe
gen qnew = qstar+newe
OLS qnew feed vet herd price / COEF=beta:4
endo
matrix bstre = newe'
matrix beta = beta'
set output
sample 1 1000
stat bstre
sample 1 1000
stat beta
stop
Thanks,
Sirak
SirakFri, 11 Apr 2014 05:56:12 +0000http://community.econometrics.com/question/486/