Limdep Handout
Total Page:16
File Type:pdf, Size:1020Kb
Limdep Handout Full Manuals are available for consultation in the Business Library, in the Economics Department General Office, and in my office. Help from the course T.A. related to accessing and running LIMDEP using NLOGIT via the VCL is available in the Econ Dept 9th Floor Computer Lab. See course web page for times. The TA will show you how to run LIMDEP programs and try to help troubleshoot basic problems, but will not write your programs for you! ▪ General Comments for programming: 1) Use “$” at the end of each command to separate commands; 2) Use semi-colon “;” to separate options within a command; 3) Use “,” to separate variables within a option (eg. dstat; rhs = income, gdp, interest ). How to run the Limdep program? ▪ Left click and select lines you wish to run. You can click “go” (or Ctrl-R or Run button on the top) ▪ If you need to re-run your program, you will often get an error message. To solve this problem, you can do as follow: (1) Select output right click clear all (2) Click “Project” menu on the top and select “Reset” To get you started here are some basic Limdep commands 1. Data Input (1) Text File Input Read; file=”location of file.txt” (eg. file=”a:\data.txt”) ; nobs=# (eg. nobs=34) ; nvars=# (eg. nvars=9) ; names= list of names of variables $ (eg. names=year, interst,…) Notes: You MUST tell Limdep the number of observations and the number of variables that you have in the text file. You also have to provide a list of variable names using the ‘names’ option. Page 1 of 4 (2) Excel File Input Read; file= “location of file.xls” ; format=xls ; names $ Notes: Make sure you include the name for each variable in the excel file. If you input your date via excel file, just use “names” in the command. You do not need to provide a list of variable names. 2. Generate Variables Create; rpgdp=gdp/pop $ Note: This command is the same as “genr” command in Shazam. calc ; list; anew2= 3/2$ Note: This command is the same as “gen1” in Shazam. Be sure to include the list option if you want the value of your variable to appear in your output file 3. Obtain Summary Statistics for a Set of Variables Dstat; Rhs=list of variables $ (eg. dstat; rhs=gdp, income, interest) Note: This command is similar to the “stat” command in Shazam and “msd” command in TSP. 4. Sample ; 1- 100 $ Note: This command is basically the same as the “sample” command in Shazam and the “smpl” command in TSP. 5. List Command list; year, interest, gdp, income,…… $ Note: Use the “list” command to make sure that your variables have been read in correctly. This command is similar to the “print” command in Shazam. 6. OLS Estimation Regress; lhs = dependent variables ; rhs = independent variables $ Note: You have to tell Limdep if you want to include an intercept. Use “one” to denote the intercept. In TSP, we use “c” to denote the intercept and Shazam assigns an intercept to OLS regression automatically. For example regress ; lhs = growth ; rhs = one, inflation, income, investment $ Page 2 of 4 7. Tests in Linear models Example: F test for restrictions b2+2b3-b4=0.5 3b1+1.2b2-b4=0 b4-b5=0 Regress; lhs =y; rhs; x1, x2, x3, x4, x5 ; cls : b(2)+2b(3)-b(4)=0.5, 3b(1)+1.2b(2)-b(4)=0, B(4) -b(5)=0 $ Note : Use “wald” instead of cls to carry out Wald tests in Linear models. 8. Heteroskadasticity consistent standard errors Regress; lhs = dependent variables ; rhs = independent variables ; het $ 9. Allowing for first order autocorrelation Regress; lhs = dependent variables ; rhs = independent variables ; AR1 $ 10. Nonlinear Estimation NLSQ ; lhs =dependent variables ; Fcn = specification of regression function ; labels = labels that have been used for elements of (eg. labels = ,. ) ; start = starting values for iterations, corresponding to each parameter in (eg. start = 0,1) ; inst = instrumental or exogenous variables ; pds = 0 (to request the white estimator ) ; pds = # (to request the Newey-West estimator. # denotes the number of lags ) $ (eg. pds=5) Example: NLSQ; fcn = rconspc – alpha – beta*rinc ; labels = alpha, beta ; start = 0, 0 ; inst = one, rinc ; pds=0 $ (although the example is ‘linear’, it illustrates the basic use of the command options) Notes: (1) “NLSQ” command can be used for the following four estimation method: ▪ Nonlinear Ordinary Least Squares Estimation ▪ Nonlinear Weighted Least Square Estimation ▪ Nonlinear Two Stage Least Square (IV) Estimation ▪ GMM Estimation (2) pds =0 must be provided to request the White estimator. This is not default in Limdep. (3) always check for error messages and make sure that the procedure has converged. Page 3 of 4 11. Frontier Command Frontier; lhs = dependent variable ; rhs = independent variables (usually includes a column of ones) ; model = model options (available options: T, E, G ) ; cost ; rhs2 = list of variables that enter the mean ; res = resname ( save residuals as a new variable) ; eff = effname (save efficiency measure as a new variable) ; maxit = maximum value of interation $ Note: (1) Use the cost option for a cost function. Omit the cost option for a production function. (2) Model options include: T (truncated normal), E (exponential), and G (gamma). The default model is half-normal. 12. Panel Data Regress; lhs = dependent variables ; rhs = independent variables ; pds = # of periods ; Panel ; random effects (or fixed effects) $ 13. Probit/Logit models: When using the Probit or Logit commands on some versions of Limdep you will need to use the ;summary option to obtain more detailed information regarding the estimated model. 14. Use /*…………….. */ to write comments in Limdep Limdep will skip this line automatically. Page 4 of 4 .