# create an empty data set with 200 observations nulldata 200 # fix a random seed for replicability set seed 1707138404 # generate a Gamma random variable x with shape k = 3 and scale theta = 2 series x = randgen(G, 3, 2) # declare and initialize the parameter estimates scalar k = 1 scalar theta = 1 # create the weight matrix as the identity matrix matrix W = I(2) # declare two series for use in the orthogonality conditions series e1 = 0 series e2 = 0 # obtain the sample mean of x scalar m = mean(x) gmm series e1 = x - k*theta series e2 = (x - m)^2 - k*theta^2 orthog e1 e2 ; const weights W params k theta end gmm