SHAZAM Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Use the PRINT command to print variables. eg:

print y x1 x2

Some examples of working with translog cost functions are here:

http://shazam.econ.ubc.ca/student/greene/cost4.sha

http://shazam.econ.ubc.ca/student/berndt/chap9.sha

For a production function the steps are usually:

* Read data from a file
read(somedata.shd) Y X1 X2

* Set sample size to work with
sample 1 100  

* Create logs of the variables
genr logY=log(Y)
genr logX1=log(X1)
genr logX2=log(X2)
genr index=time(0)

* Calculate cross product 
genr logX12=logX1*logX2
genr logX11=0.5*logX1**2
genr logX22=0.5*logX2**2
genr index2=index**2

* OLS estimates of the coefficients of the translog production function
ols logY logX1 logX2 logX12 logX11 logX22 index index2 / coef=beta

* keep the number of variables
gen1 k=$k-1

* Show the coefficients previously saved 
print beta

To compute elasticities you may use the STAT command to get the means of all variables. It is important to note that elasticities of log transformed variables are calculated differently.

* First copy the data to a matrix called Z (remember the constant)
genr const=1
copy logX1 logX2 logX12 logX11 logX22 index index2  const Z

* Calculating elasticities at mean
stat Z / mean=zbar

* Evaluate at the sample mean's
matrix m=zbar'beta
gen1 f=ncdf(m)
gen1 fden=exp(-m*m/2)/sqrt(2*$pi)

* Calculate elasticities assuming variables are in levels.
sample 1 K
genr em=fden*beta*zbar/f

* Now calculate elasticities assuming LOG-transformed variables.
genr eml=fden*beta/f

Source and further examples of various elasticity calculations with SHAZAM are here: http://econpapers.repec.org/software/shzshazam/probelas.htm

click to hide/show revision 2
Minor syntax improvements

Use the PRINT command to print variables. eg:

print y x1 x2

Some examples of working with translog cost functions are here:

http://shazam.econ.ubc.ca/student/greene/cost4.sha

http://shazam.econ.ubc.ca/student/berndt/chap9.sha

For a production function the steps are usually:

* Read data from a file
read(somedata.shd) Y X1 X2

* Set sample size to work with
sample 1 100  

* Create logs of the variables
genr logY=log(Y)
genr logX1=log(X1)
genr logX2=log(X2)
genr index=time(0)

* Calculate cross product 
genr logX12=logX1*logX2
genr logX11=0.5*logX1**2
genr logX22=0.5*logX2**2
genr index2=index**2

* OLS estimates of the coefficients of the translog production function
ols logY logX1 logX2 logX12 logX11 logX22 index index2 / coef=beta

* keep the number of variables
gen1 k=$k-1

* Show the coefficients previously saved 
print beta

To compute elasticities you may use the STAT command to get the means of all variables. It is important to note that elasticities of log transformed variables are calculated differently.

* First copy the data to a matrix called Z (remember the constant)
genr const=1
copy logX1 logX2 logX12 logX11 logX22 index index2  const Z

* Calculating elasticities at mean
stat Z / mean=zbar

* Evaluate at the sample mean's
matrix m=zbar'beta
M=zbar'beta
gen1 f=ncdf(m)
f=ncdf(M)
gen1 fden=exp(-m*m/2)/sqrt(2*$pi)
fden=exp(-M*M/2)/sqrt(2*$pi)

* Calculate elasticities assuming variables are in levels.
sample 1 K
genr em=fden*beta*zbar/f

* Now calculate elasticities assuming LOG-transformed log transformed variables.
genr eml=fden*beta/f

* Show the elasticities of log transformed variables
print eml

Source and further examples of various elasticity calculations with SHAZAM are here: http://econpapers.repec.org/software/shzshazam/probelas.htm

Use the PRINT command to print variables. eg:

print y x1 x2

Some examples of working with translog cost functions are here:

http://shazam.econ.ubc.ca/student/greene/cost4.sha

http://shazam.econ.ubc.ca/student/berndt/chap9.sha

For a production function the steps are usually:

* Read data from a file
read(somedata.shd) Y X1 X2

* Set sample size to work with
sample 1 100  

* Create logs of the variables
genr logY=log(Y)
genr logX1=log(X1)
genr logX2=log(X2)
genr index=time(0)

* Calculate cross product  manually (or convert to matrix)
genr logX12=logX1*logX2
genr logX11=0.5*logX1**2
genr logX22=0.5*logX2**2
genr index2=index**2

* OLS estimates of the coefficients of the translog production function
ols logY logX1 logX2 logX12 logX11 logX22 index index2 / coef=beta

* keep Keep the number of variables
gen1 k=$k-1

* Show the coefficients previously saved 
print beta

To compute elasticities you may use the STAT command to get the means of all variables. It is important to note that elasticities of log transformed variables are calculated differently.

* First copy the data to a matrix called Z (remember the constant)
genr const=1
copy logX1 logX2 logX12 logX11 logX22 index index2  const Z

* Calculating elasticities at mean
stat Z / mean=zbar

* Evaluate at the sample mean's
matrix M=zbar'beta
gen1 f=ncdf(M)
gen1 fden=exp(-M*M/2)/sqrt(2*$pi)

* Calculate elasticities assuming variables are in levels.
sample 1 K
genr em=fden*beta*zbar/f

* Now calculate elasticities assuming log transformed variables.
genr eml=fden*beta/f

* Show the elasticities of log transformed variables
print eml

Source and further examples of various elasticity calculations with SHAZAM are here: http://econpapers.repec.org/software/shzshazam/probelas.htm

Use the PRINT command to print variables. eg:

print y x1 x2

Some Two useful examples of working with translog cost functions are here:

http://shazam.econ.ubc.ca/student/greene/cost4.sha

http://shazam.econ.ubc.ca/student/berndt/chap9.sha

For a production function the steps are usually:

* Read data from a file
read(somedata.shd) Y X1 X2

* Set sample size to work with
sample 1 100  

* Create logs of the variables
genr logY=log(Y)
genr logX1=log(X1)
genr logX2=log(X2)
genr index=time(0)

* Calculate cross product manually (or convert to matrix)
genr logX12=logX1*logX2
genr logX11=0.5*logX1**2
genr logX22=0.5*logX2**2
genr index2=index**2

* OLS estimates of the coefficients of the translog production function
ols logY logX1 logX2 logX12 logX11 logX22 index index2 / coef=beta

* Keep the number of variables
gen1 k=$k-1

* Show the coefficients previously saved 
print beta

To compute elasticities you may use the STAT command to get the means of all variables. It is important to note that elasticities of log transformed variables are calculated differently.

* First copy the data to a matrix called Z (remember the constant)
genr const=1
copy logX1 logX2 logX12 logX11 logX22 index index2  const Z

* Calculating elasticities at mean
stat Z / mean=zbar

* Evaluate at the sample mean's
matrix M=zbar'beta
gen1 f=ncdf(M)
gen1 fden=exp(-M*M/2)/sqrt(2*$pi)

* Calculate elasticities assuming variables are in levels.
sample 1 K
genr em=fden*beta*zbar/f

* Now calculate elasticities assuming log transformed variables.
genr eml=fden*beta/f

* Show the elasticities of log transformed variables
print eml

Source and further examples of various elasticity calculations with SHAZAM are here: http://econpapers.repec.org/software/shzshazam/probelas.htm

Use the PRINT command to print variables. eg:

print y x1 x2

Two useful examples of working with translog cost functions are here:

http://shazam.econ.ubc.ca/student/greene/cost4.sha

http://shazam.econ.ubc.ca/student/berndt/chap9.sha

For a production function the steps are usually:

* Read data from a file
read(somedata.shd) Y X1 X2

* Set sample size to work with
sample 1 100  

* Create logs of the variables
genr logY=log(Y)
genr logX1=log(X1)
genr logX2=log(X2)
genr index=time(0)

* Calculate cross product manually (or convert to matrix)
genr logX12=logX1*logX2
genr logX11=0.5*logX1**2
genr logX22=0.5*logX2**2
genr index2=index**2

* OLS estimates of the coefficients of the translog production function
ols logY logX1 logX2 logX12 logX11 logX22 index index2 / coef=beta

* Keep the number of variables
gen1 k=$k-1

* Show the coefficients previously saved 
print beta

To compute elasticities you may use the STAT command to get the means of all variables. It is important to note that elasticities of log transformed variables are calculated differently.

* First copy the data to a matrix called Z (remember the constant)
genr const=1
copy logX1 logX2 logX12 logX11 logX22 index index2  const Z

* Calculating elasticities at mean
stat Z / mean=zbar

* Evaluate at the sample mean's
means
matrix M=zbar'beta
gen1 f=ncdf(M)
gen1 fden=exp(-M*M/2)/sqrt(2*$pi)

* Calculate elasticities assuming variables are in levels.
sample 1 K
genr em=fden*beta*zbar/f

* Now calculate elasticities assuming log transformed variables.
genr eml=fden*beta/f

* Show the elasticities of log transformed variables
print eml

Source and further examples of various elasticity calculations with SHAZAM are here: http://econpapers.repec.org/software/shzshazam/probelas.htm

Use the PRINT command to print variables. eg:

print y x1 x2

Following any estimation, the number of variables used are in the temporary variable $K so do print $K. Likewise the number of observations can be found using $N

Two useful examples of working with translog cost functions are here:

http://shazam.econ.ubc.ca/student/greene/cost4.sha

http://shazam.econ.ubc.ca/student/berndt/chap9.sha

For a production function the steps are usually:

* Read data from a file
read(somedata.shd) Y X1 X2

* Set sample size to work with
sample 1 100  

* Create logs of the variables
genr logY=log(Y)
genr logX1=log(X1)
genr logX2=log(X2)
genr index=time(0)

* Calculate cross product manually (or convert to matrix)
genr logX12=logX1*logX2
genr logX11=0.5*logX1**2
genr logX22=0.5*logX2**2
genr index2=index**2

* OLS estimates of the coefficients of the translog production function
ols logY logX1 logX2 logX12 logX11 logX22 index index2 / coef=beta

* Keep the number of variables
gen1 k=$k-1

* Show the coefficients previously saved 
print beta

To compute elasticities you may use the STAT command to get the means of all variables. It is important to note that elasticities of log transformed variables are calculated differently.

* First copy the data to a matrix called Z (remember the constant)
genr const=1
copy logX1 logX2 logX12 logX11 logX22 index index2  const Z

* Calculating elasticities at mean
stat Z / mean=zbar

* Evaluate at the sample means
matrix M=zbar'beta
gen1 f=ncdf(M)
gen1 fden=exp(-M*M/2)/sqrt(2*$pi)

* Calculate elasticities assuming variables are in levels.
sample 1 K
genr em=fden*beta*zbar/f

* Now calculate elasticities assuming log transformed variables.
genr eml=fden*beta/f

* Show the elasticities of log transformed variables
print eml

Source and further examples of various elasticity calculations with SHAZAM are here: http://econpapers.repec.org/software/shzshazam/probelas.htm

Use the PRINT command to print variables. eg:

print y x1 x2

x2

Following any estimation, the number of variables and the number of observations used are in the estimation are stored in the temporary variable variables $\$K$, $\$N$ respectively and may be printed the same way. eg.

print $K so do print $K.  Likewise the number of observations can be found using $N

$N

Two useful examples of working with translog cost functions are here:

http://shazam.econ.ubc.ca/student/greene/cost4.sha

http://shazam.econ.ubc.ca/student/berndt/chap9.sha

For a production function the steps are usually:

* Read data from a file
read(somedata.shd) Y X1 X2

* Set sample size to work with
sample 1 100  

* Create logs of the variables
genr logY=log(Y)
genr logX1=log(X1)
genr logX2=log(X2)
genr index=time(0)

* Calculate cross product manually (or convert to matrix)
genr logX12=logX1*logX2
genr logX11=0.5*logX1**2
genr logX22=0.5*logX2**2
genr index2=index**2

* OLS estimates of the coefficients of the translog production function
ols logY logX1 logX2 logX12 logX11 logX22 index index2 / coef=beta

* Keep the number of variables
gen1 k=$k-1

* Show the coefficients previously saved 
print beta

To compute elasticities you may use the STAT command to get the means of all variables. It is important to note that elasticities of log transformed variables are calculated differently.

* First copy the data to a matrix called Z (remember the constant)
genr const=1
copy logX1 logX2 logX12 logX11 logX22 index index2  const Z

* Calculating elasticities at mean
stat Z / mean=zbar

* Evaluate at the sample means
matrix M=zbar'beta
gen1 f=ncdf(M)
gen1 fden=exp(-M*M/2)/sqrt(2*$pi)

* Calculate elasticities assuming variables are in levels.
sample 1 K
genr em=fden*beta*zbar/f

* Now calculate elasticities assuming log transformed variables.
genr eml=fden*beta/f

* Show the elasticities of log transformed variables
print eml

Source and further examples of various elasticity calculations with SHAZAM are here: http://econpapers.repec.org/software/shzshazam/probelas.htm

Use the PRINT command to print variables. eg:

print y x1 x2

Following any estimation, the number of variables and the number of observations used in the estimation are stored in the temporary variables $\$K$, $\$N$ respectively and may be printed the same way. eg.

print $K $N

Two useful examples of working with translog cost functions are here:

http://shazam.econ.ubc.ca/student/greene/cost4.sha

http://shazam.econ.ubc.ca/student/berndt/chap9.sha

For a production function the steps are usually:

* Read data from a file
read(somedata.shd) Y X1 X2

* Set sample size to work with
sample 1 100  

* Create logs of the variables
genr logY=log(Y)
genr logX1=log(X1)
genr logX2=log(X2)
genr index=time(0)

* Calculate cross product manually (or convert to matrix)
genr logX12=logX1*logX2
genr logX11=0.5*logX1**2
genr logX22=0.5*logX2**2
genr index2=index**2

* OLS estimates of the coefficients of the translog production function
ols logY logX1 logX2 logX12 logX11 logX22 index index2 / coef=beta

* Keep the number of variables
gen1 k=$k-1

* Show the coefficients previously saved 
print beta

To compute elasticities you may use the STAT command to get the means of all variables. It is important to note that elasticities of log transformed variables are calculated differently.

* First copy the data to a matrix called Z (remember the constant)
genr const=1
copy logX1 logX2 logX12 logX11 logX22 index index2  const Z

* Calculating elasticities at mean
stat Z / mean=zbar

* Evaluate at the sample means
matrix M=zbar'beta
gen1 f=ncdf(M)
gen1 fden=exp(-M*M/2)/sqrt(2*$pi)

* Calculate elasticities assuming variables are in levels.
sample 1 K
genr em=fden*beta*zbar/f

* Now calculate elasticities assuming log transformed variables.
genr eml=fden*beta/f

* Show the elasticities of log transformed variables
print eml

Source and further examples of various elasticity calculations with SHAZAM are here: http://econpapers.repec.org/software/shzshazam/probelas.htm

Use the PRINT command to print variables. eg:

print y x1 x2

Following any estimation, the number of variables and the number of observations used in the estimation are stored in the temporary variables $\$K$, $\$N$ respectively and may be printed the same way. eg.

print $K $N

Two useful examples of working with translog cost functions are here:

http://shazam.econ.ubc.ca/student/greene/cost4.sha

http://shazam.econ.ubc.ca/student/berndt/chap9.sha

For a production function the steps are usually:

* Read data from a file
read(somedata.shd) Y X1 X2

* Set sample size to work with
sample 1 100  

* Create logs of the variables
genr logY=log(Y)
genr logX1=log(X1)
genr logX2=log(X2)
genr index=time(0)

* Calculate cross product manually (or convert to matrix)
genr logX12=logX1*logX2
genr logX11=0.5*logX1**2
genr logX22=0.5*logX2**2
genr index2=index**2

* OLS estimates of the coefficients of the translog production function
ols logY logX1 logX2 logX12 logX11 logX22 index index2 / coef=beta

* Keep the number of variables
gen1 k=$k-1

* Show the coefficients previously saved 
print beta

To compute elasticities you may use the STAT command to get the means of all variables. It is important to note that elasticities of log transformed variables are calculated differently.

* First copy the data to a matrix called Z (remember the constant)
genr const=1
copy logX1 logX2 logX12 logX11 logX22 index index2  const Z

* Calculating elasticities at mean
stat Z / mean=zbar

* Evaluate at the sample means
matrix M=zbar'beta
gen1 f=ncdf(M)
gen1 fden=exp(-M*M/2)/sqrt(2*$pi)

* Calculate elasticities assuming variables are in levels.
sample 1 K
genr em=fden*beta*zbar/f

* Now calculate elasticities assuming log transformed variables.
genr eml=fden*beta/f

* Show the elasticities of log transformed variables
print eml

Source and further examples of various elasticity calculations with SHAZAM are here: http://econpapers.repec.org/software/shzshazam/probelas.htm