{smcl} {* *! version 1.0.0 // A METTRE}{...} {cmd:help xtnptimevar} {hline} {title:Title} {pstd} {hi: Performs Estimations of Non-Parametric Time-Varying Coefficients Panel Data Models with Fixed Effects} {title:Syntax} {p 8 17 2} {cmd:xtnptimevar} {depvar} {indepvars} {ifin} [{cmd:,} {it:options}] {synoptset 20 tabbed}{...} {synopthdr} {synoptline} {syntab:Main} {synopt:{opt stub(string)}}designates a string name from which new objects' names (variables, graphs, standard errors, …) will be created {p_end} {synopt:{opt bwidth(#)}}uses {it:#} for the bandwidth; default employs a data driven rule of thumb bandwidth {p_end} {synopt:{opt forcereg}}this option explicitly balances the panel data before the estimation {p_end} {synopt:{opt alle}}this option allows using the averaged local linear estimator; the default employs the local linear dummy variable estimator {p_end} {synopt:{opt nographs}}removes the display of graphs after the estimations are performed {p_end} {synopt:{opt sav:ing(string)}}allows to save the graphs and other objects that the command creates {p_end} {synopt:{opt title(string)}}this option allows the user to specify his own title for the graphs generated by the estimation {p_end} {synopt:{opt bootstrap}}triggers the computation of the pointwise standard errors and confidence intervals via bootstrap; by default they are not calculated {p_end} {synopt:{it:{help bootstrap:bootoptions(string)}}}in this option, you specify a list of nearly all the options allowed by the {help bootstrap} command {p_end} {synopt:{opt matsize(#)}} sets the maximum number of variables through the command {help matsize} when the {opt bootstrap} option is specified {p_end} {synoptline} {p2colreset}{...} {p 4 6 2} You must {cmd:tsset} your data before using {cmd:xtnptimevar}; see {helpb tsset}.{p_end} {p 4 6 2} {indepvars} may contain time-series operators; see {help tsvarlist}.{p_end} {p 4 6 2} {cmd:by} is not allowed with {hi:xtnptimevar}; see {manhelp by D} for more details on {cmd:by}.{p_end} {title:Description} {pstd} {cmd:xtnptimevar} performs estimations of non-parametric time-varying coefficients panel data models with fixed effects. Often researchers desire to estimate the effects of some regressors on the dependent variable in a nonlinear fashion in the context of panel data without imposing a specific functional form. In other words they want the data to reveal this functional form by letting them speak for themselves. The command {cmd:xtnptimevar} exactly does that. It offers two estimators: the local linear dummy variable estimator (the default) and the averaged local linear estimator. Both of these two techniques allow estimating coefficients that vary over time for panel data models. These two estimators were invented by Li, Chen and Gao (2011). The theory behind the command {cmd:xtnptimevar} is provided in their paper. {title:Options} {dlgtab:Main} {phang} {opt stub(string)} designates a string name from which new objects' names (variables, graphs, standard errors, …) will be created. To form this option, you put inside the brackets a string name (without the double quotes). Then new objects' names will be created from this string. You must specify this option in order to get a result. Hence this option is required. {phang} {opt bwidth(#)} uses {it:#} to specify the value of the bandwidth. The default employs a data driven rule of thumb bandwidth that corresponds to the Epanechnikov Kernel (Quadratic kernel) internally used by the command, and that also satisfies assumption 2.4 of Li, Chen and Gao (2011) paper. You can override this default value by putting a positive real number inside the brackets. The greater the {opt bwidth()}, the greater the smoothing. {phang} {opt forcereg} explicitly balances the panel data before the estimation. The command {cmd:xtnptimevar} works only on strongly balanced panel data. Hence if your data are not balanced, you should find a way to obtain a balanced panel by choosing an appropriate econometric method or any technique that you find convenient before employing the command; or else use this option to explicitly do it for you. {phang} {opt alle} allows using the averaged local linear estimator. The default employs the local linear dummy variable estimator which has a quicker asymptotic rate of convergence than the averaged local linear estimator as suggested by Li, Chen and Gao (2011). But the averaged local linear estimator is faster to compute in practice than the local linear dummy variable estimator. Hence if you are concerned about efficiency, use the local linear dummy variable estimator (the default); and if you are worried about speed of calculation employ the averaged local linear estimator. {phang} {opt nographs} suppresses the display of graphs after the estimations are performed. This option is used when we do not want to display the graphs after the estimations are done. {phang} {opt sav:ing(string)} in this option, you specify the complete file path where you want to save the graphs produced by the command. You must enclose de path in double quotes. If you do not specify this option, the graphs will be displayed, if you do not choose the {opt nographs} option, but they will not be saved. This {opt sav:ing(string)} option is optional when you do not specify the {opt bootstrap} option, meaning that you can omit it, if you want, in this case. But this option is required when you choose the {opt bootstrap} option. In this situation, the option {opt sav:ing(string)} is mandatory and allows saving new objects (variables, graphs, standard errors, databases, …) that the {opt bootstrap} option creates. {phang} {opt title(string)} this option allows the user to give his title for the graphs generated by the estimation. You specify this option when you want to override the default graph names provided by the command. In this case, put a string corresponding to the name you want for the graphs inside the option {opt title(string)} without the double quotes. {phang} {opt bootstrap} triggers the computation of the pointwise standard errors and confidence intervals via bootstrap. By default the command {cmd:xtnptimevar} only computes the coefficient-vectors in function of time. If you want to calculate the pointwise standard errors and confidence intervals for the coefficient-vectors, specify the {opt bootstrap} option. {phang} {it:{help bootstrap:bootoptions(string)}} in this option, you specify a list of nearly all the options allowed by the {help bootstrap} command. Except the following options: {opth cluster(varlist)}, {opth idcluster(newvar)}, {help prefix_saving_option:{bf:{ul:sa}ving(}{it:filename}{bf:, ...)}} which are already used internally by the command {cmd:xtnptimevar}, nearly all the other options of the {help bootstrap} command can be included in the option {it:{help bootstrap:bootoptions(string)}}. To form them, enter inside the brackets the options of the {help bootstrap} command separated by blank spaces as you would do with the {help bootstrap} command. Some of these options are: {opt l:evel(#)}, {opt seed(#)}, {opt nodots}, etc. The {it:{help bootstrap:bootoptions(string)}} option is for use in conjunction with the {opt bootstrap} option. {phang} {opt matsize(#)} sets the maximum number of variables through the command {help matsize} when the {opt bootstrap} option is specified. We have {cmd:10} {ul:<} {it:#} {ul:<} {cmd:11000} for Stata/MP and Stata/SE and {cmd:10} {ul:<} {it:#} {ul:<} {cmd:800} for Stata/IC. By default {it:#} = {cmd:800} in the command {cmd:xtnptimevar}. The {help matsize} option is for use in conjunction with the {opt bootstrap} option. {title:Return values} {pstd} {cmd:xtnptimevar} saves the following results in {cmd:e()} when the {opt bootstrap} option is not specified: {col 4}Scalars {col 8}{cmd:e(N)}{col 27}Number of observations used {col 8}{cmd:e(T)}{col 27}Time used {col 8}{cmd:e(bwidth)}{col 27}The computed or specified bandwidth {col 8}{cmd:e(k)}{col 27}Number of regressors used {col 8}{cmd:e(NT)}{col 27}Total number of observations used {col 8}{cmd:e(g_avg)}{col 27}Average number of observations per included individual {col 8}{cmd:e(g_min)}{col 27}Lowest number of observations in an included individual {col 8}{cmd:e(g_max)}{col 27}Highest number of observations in an included {col 27}individual {col 4}Macros {col 8}{cmd:e(cmdline)}{col 27}Command as typed by the user {col 8}{cmd:e(cmd)}{col 27}"xtnptimevar", command name {col 8}{cmd:e(seq_stub_efftv)}{col 27}Effective time variable used for the calculation {col 27}and the plotting of the coefficient-vectors {col 8}{cmd:e(seq_stub_b_i)}{col 27}The sequence of coefficient-vectors. If you have {col 27}k regressors, you will obtain i = 1...k+1 {col 27}sequences of coefficient-vectors {col 8}{cmd:e(ivar)}{col 27}Individual (panel) variable {col 8}{cmd:e(depvar)}{col 27}Dependent variable {col 4}Functions {col 8}{cmd:e(sample)}{col 27}Marks estimation sample {pstd} {cmd:xtnptimevar} saves the following results in {cmd:e()} when the {opt bootstrap} option is specified: {col 4}Scalars {col 8}{cmd:e(N)}{col 27}Number of observations used {col 8}{cmd:e(T)}{col 27}Time used {col 8}{cmd:e(bwidth)}{col 27}The computed or specified bandwidth {col 8}{cmd:e(k)}{col 27}Number of regressors used {col 8}{cmd:e(NT)}{col 27}Total number of observations used {col 8}{cmd:e(g_avg)}{col 27}Average number of observations per included individual {col 8}{cmd:e(g_min)}{col 27}Lowest number of observations in an included individual {col 8}{cmd:e(g_max)}{col 27}Highest number of observations in an included {col 27}individual {col 4}Macros {col 8}{cmd:e(cmdline)}{col 27}Command as typed by the user {col 8}{cmd:e(cmd)}{col 27}"xtnptimevar", command name {col 8}{cmd:e(seq_stub_efftv)}{col 27}Effective time variable used for the calculation {col 27}and the plotting of the coefficient-vectors {col 8}{cmd:e(seq_stub_ciul_i)}{col 27}The sequence of upper limits confidence intervals {col 27}of the coefficient-vectors. {col 27}If you have k regressors, you will obtain i = 1...k+1 {col 27}sequences of upper limits confidence {col 27}intervals; they are Normal-based only {col 8}{cmd:e(seq_stub_cill_i)}{col 27}The sequence of lower limits confidence intervals {col 27}of the coefficient-vectors. {col 27}If you have k regressors, you will obtain i = 1...k+1 {col 27}sequences of lower limits confidence {col 27}intervals; they are Normal-based only {col 8}{cmd:e(seq_stub_se_i)}{col 27}The sequence of bootstrapped standard errors of the {col 27}coefficient-vectors. If you have k regressors, you {col 27}will obtain i = 1...k+1 sequences of standard errors {col 8}{cmd:e(seq_stub_b_i)}{col 27}The sequence of coefficient-vectors. If you have {col 27}k regressors, you will obtain i = 1...k+1 {col 27}sequences of coefficient-vectors {col 8}{cmd:e(vcetype)}{col 27}Title used to label standard errors {col 8}{cmd:e(cluster)}{col 27}Cluster variables {col 8}{cmd:e(seed)}{col 27}Initial random-number seed {col 8}{cmd:e(clustvar)}{col 27}Cluster variables {col 8}{cmd:e(stubloc)}{col 27}A string indicating the content of the {opt stub()} option {col 8}{cmd:e(nombreco)}{col 27}Total number of coefficient-vectors estimated (k+1) {col 8}{cmd:e(ivar)}{col 27}Individual (panel) variable {col 8}{cmd:e(depvar)}{col 27}Dependent variable {col 4}Functions {col 8}{cmd:e(sample)}{col 27}Marks estimation sample {title:Warning} {pstd} The command {cmd:xtnptimevar}, like many non-parametric estimation techniques, is highly computationally intensive and may for that reason take a very long time to run on a sluggish machine. {marker remarks1}{...} {title:Examples} {p 4 8 2} Before beginning the estimations, we use the {hi:set more off} instruction to tell {hi:Stata} not to pause when displaying the output. {p_end} {p 4 8 2}{stata "set more off"}{p_end} {p 4 8 2} We illustrate the use of the command {hi:xtnptimevar} with the dataset {hi:xtnptimevardata.dta}. This dataset contains panel data of 51 countries from 1980 to 2012. {p_end} {p 4 8 2}{stata "use http://fmwww.bc.edu/repec/bocode/x/xtnptimevardata.dta, clear"}{p_end} {p 4 8 2} Next we describe the dataset to see the definition of each variable. The dependent variable is Total factor productivity growth calculated as a Solow residual. The regressors are Openness, Financial development, Government consumption expenditures, Gross inflation and Investment. All these regressors are logged and quadratically filtered to satisfy the stationarity assumption of the independent variables in the Li, Chen and Gao (2011) paper. We also have the variable Income level indicating whether the country belongs to the high income category or not. {p_end} {p 4 8 2}{stata "describe"}{p_end} {p 4 8 2} It is important to remind the reader that the command {cmd:xtnptimevar}, particularly with the {opt bootstrap} option, is highly computationally intensive and may take a very long time to run. For instance to execute all instructions (all the lines) included in this {hi:Examples} section, in my machine, it took 104274.5760 seconds. This is not a performance issue of the command but it is due to the nature of the estimation technique (non-parametric estimation). To even speed the computation process, many parts of the package are written in {bf:{help Mata}}. {p_end} {p 4 8 2} Now let's turn to the estimations. We regress the dependent variable (tfpg) on the variable of interest (openness) and the control variables (govcons inflation invest). We also specify the option {opt stub()} in which we put the string "coefsa" without the double quotes. This option is required. {p_end} {p 4 8 2}{stata "xtnptimevar tfpg openness govcons inflation invest, stub(coefsa)"}{p_end} {p 4 8 2} The previous estimation gives 5 graphs. The first correspond to the trend function (Coefficient-Vector 1) and the others to the coefficient functions (Coefficient-Vector 2 to Coefficient-Vector 5). In the estimators provided by Li, Chen and Gao (2011), the coefficients are smooth functions of time, they are called in the command {cmd:xtnptimevar} Coefficient-Vectors to differentiate them with the scalar values that someone would obtain in a traditional fixed effects panel data model. Thus in the previous regression, the trend function is named Coefficient-Vector 1, the coefficient of {hi:openness} is named Coefficient-Vector 2, the coefficient of {hi:govcons} is named Coefficient-Vector 3, the coefficient of {hi: inflation} is named Coefficient-Vector 4 and the coefficient of {hi:invest} is named Coefficient-Vector 5. We observe that openness has a negative effect on total factor productivity growth from the mid-1980s to the mid-1990s and roughly a positive impact from the mid-1990s to the year 2010. {p_end} {p 4 8 2} The previous estimation also generates variables containing the Coefficient-Vectors and the Effective time variable used for the calculation and the plotting of the Coefficient-Vectors. To see these variables, we type: {p_end} {p 4 8 2}{stata "describe coefsa_*"}{p_end} {p 4 8 2} The next regression shows how to use the {opt alle} option. This option allows using the averaged local linear estimator instead of the local linear dummy variable estimator (the default). {p_end} {p 4 8 2}{stata "xtnptimevar tfpg openness govcons inflation invest, stub(coefsb) alle"}{p_end} {p 4 8 2} Now we increase the number of control variables by introducing financial development. {p_end} {p 4 8 2}{stata "xtnptimevar tfpg openness finddev govcons inflation invest, stub(coefsc)"}{p_end} {p 4 8 2} We obtained an error message telling us that the command {cmd:xtnptimevar} requires strongly balanced data. At this point we could either find a way to get a balanced panel data on our own or use the option {opt forcereg} to explicitly do it for us. Here we choose to employ the option {opt forcereg}. {p_end} {p 4 8 2}{stata "xtnptimevar tfpg openness finddev govcons inflation invest, stub(coefsd) forcereg"}{p_end} {p 4 8 2} We illustrate how to use the {opt bwidth(#)} option. Instead of the default which employs a data driven rule of thumb bandwidth, we choose to provide our own bandwidth. We pick it here to be 0.15. Remember that the greater the {opt bwidth()}, the greater the smoothing. {p_end} {p 4 8 2}{stata "xtnptimevar tfpg openness govcons inflation invest, stub(coefse) bwidth(0.15)"}{p_end} {p 4 8 2} If we do not want to display the graphs, we type: {p_end} {p 4 8 2}{stata "xtnptimevar tfpg openness govcons inflation invest, stub(coefsf) alle nographs"}{p_end} {p 4 8 2} In the following, we demonstrate how to use the {opt saving(string)} option. Assume that you have Windows as your Operating System and you want to save the graphs produced by the command {cmd:xtnptimevar} in a folder named "mystatagraphs" located in the "C:\" drive. So the full path name is "C:\mystatagraphs". Note that, you must physically create this folder; otherwise the next instruction will not work at all. Also if you have an Operating System other than Windows, you must supply the correct file path according to your Platform. To save the graphs in the "mystatagraphs" folder, just type (without forgetting the double quotes): {p_end} {p 4 8 2}{stata `"xtnptimevar tfpg openness finddev govcons inflation invest, stub(coefsg) forcereg saving("C:\mystatagraphs")"'}{p_end} {p 4 8 2} If you open the folder "mystatagraphs", you will find that it contains 6 graphs. If you want to save another set of graphs in the same folder, just change the name that you put in the {opt stub()} option. For instance, change it to "newg" and you will have 6 more graphs in the folder "mystatagraphs". {p_end} {p 4 8 2} In the next line we override the default graph names provided by the command by putting a string corresponding to the name we want for the graphs inside the option {opt title()} without the double quotes. {p_end} {p 4 8 2}{stata "xtnptimevar tfpg openness finddev govcons inflation invest, stub(coefsh) alle forcereg title(The Graph of the Nonlinear Coefficient)"}{p_end} {p 4 8 2} Now we illustrate how to use the {opt bootstrap} option. This option triggers the computation of the pointwise standard errors and confidence intervals by using the bootstrap technique. Often when you set the {opt bootstrap} option, you will also need to specify the {opt matsize(#)} option to indicate the maximum number of variables through the command {help matsize}. When your dataset is big, you will need to increase the number inside the {opt matsize()} option. Additionally when you choose the {opt bootstrap} option, you must specify the {opt saving(string)} option which indicate the complete file path where to save the new objects that the {opt bootstrap} option creates. Hence when the {opt bootstrap} option is chosen, the {opt saving(string)} option becomes required. {p_end} {p 4 8 2}{stata `"xtnptimevar tfpg openness govcons inflation invest, stub(coefsi) bootstrap matsize(800) saving("C:\mystatagraphs")"'}{p_end} {p 4 8 2} The previous estimation provides 5 graphs. The first correspond to the trend function and is named "Graph of Coefficient-Vector 1". Coefficient-Vector 1 is the red line in the figure. We observe that, contrarily to the previous graphs, there is a gray band around the curve of Coefficient-Vector 1. This is the 95% confidence interval. This confidence interval is normal based only, hence the "NB" abbreviation on the figure. The remaining 4 graphs represent the graphs of the coefficients of the regressors (openness, govcons, inflation, invest) with their respective confidence intervals. They are named graph of (Coefficient-Vector 2, …, Coefficient-Vector 5) respectively. The estimation also gives 5 regression tables. Each represents the bootstrapped regression table of a Coefficient-Vector. For instance the estimation of the trend function (Coefficient-Vector 1) is given in the first table. Unlike traditional fixed effects panel regressions, we see that, in the first column of the first table of results, instead of the variables' names, there are as a substitute years. This is because Coefficient-Vector 1 depends on years (the coefficients of the estimation are smooth functions of time). The second column of the estimation results of Coefficient-Vector 1 represents the observed values of Coefficient-Vector 1, the others are respectively, the Bootstrap Std. Err., the Z-statistics, the P-values and the Normal-based 95% Conf. Interval for every year used in the regression. The remaining 4 tables of results correspond to the bootstrapped tables of the coefficients of the regressors (openness, govcons, inflation, invest), that is Coefficient-Vector 2 to Coefficient-Vector 5 respectively. {p_end} {p 4 8 2} The previous estimation also generates variables containing the Coefficient-Vectors, the Effective time variable used for the calculation and the plotting of the Coefficient-Vectors, the Sequence of upper and lower limits confidence intervals of the Coefficient-Vectors, and their Sequence of bootstrapped standard errors. To see all these variables, we type: {p_end} {p 4 8 2}{stata "describe coefsi_*"}{p_end} {p 4 8 2} Next we demonstrate how to employ the {it:{help bootstrap:bootoptions(string)}} option. As stated previously, in this option, you specify a list of nearly all the options allowed by the {help bootstrap} command. To form them, we enter inside the brackets the options of the {help bootstrap} command separated by blank spaces as we would do with the {help bootstrap} command. For instance, here we choose to increase the number of bootstrap replications to 70 and suppress the replication dots. {p_end} {p 4 8 2}{stata `"xtnptimevar tfpg openness govcons inflation invest, stub(coefsj) alle bootstrap bootoptions(reps(70) nodots) matsize(800) saving("C:\mystatagraphs")"'}{p_end} {p 4 8 2} In the following line we set the random-number seed to "375235" and the confidence level to 99. {p_end} {p 4 8 2}{stata `"xtnptimevar tfpg openness govcons inflation invest, stub(coefsk) alle bootstrap bootoptions(reps(70) seed(375235) level(99)) matsize(800) saving("C:\mystatagraphs")"'}{p_end} {p 4 8 2} To close this {hi:Examples} section, we show how to use the command {cmd:xtnptimevar} with the {help if} qualifier. First we tabulate the variable {hi:inlevel}. We see that this variable is a dummy variable indicating whether a country is developed or not. {p_end} {p 4 8 2}{stata "tabulate inlevel"}{p_end} {p 4 8 2} We run a regression on the subsample of developed countries. {p_end} {p 4 8 2}{stata "xtnptimevar tfpg openness govcons inflation invest if inlevel==1, stub(coefsl) alle"}{p_end} {p 4 8 2} We do the same thing on the subsample of developing countries. {p_end} {p 4 8 2}{stata "xtnptimevar tfpg openness govcons inflation invest if inlevel==0, stub(coefsm) alle"}{p_end} {p 4 8 2} We perform an estimation for all years greater than 1984. {p_end} {p 4 8 2}{stata "xtnptimevar tfpg openness govcons inflation invest if year>1984, stub(coefsn) alle"}{p_end} {p 4 8 2} Next we run a regression on the subsample of developed countries and for the years between 1990 and 2010. {p_end} {p 4 8 2}{stata `"xtnptimevar tfpg openness govcons inflation invest if inlevel==1 & year>=1990 & year<=2010, stub(coefso) alle bootstrap bootoptions(level(99)) matsize(800) saving("C:\mystatagraphs")"'}{p_end} {p 4 8 2} We do the same thing as above on the subsample of developing countries. {p_end} {p 4 8 2}{stata `"xtnptimevar tfpg openness govcons inflation invest if inlevel==0 & year>=1990 & year<=2010, stub(coefsp) alle bootstrap bootoptions(level(99)) matsize(800) saving("C:\mystatagraphs")"'}{p_end} {title:References} {pstd} Degui Li, Jia Chen and Jiti Gao: 2011, "Non-parametric Time-Varying Coefficient Panel Data Models with Fixed Effects", {it:The Econometrics Journal} {bf:14}, 387-408. {p_end} {title:Acknowledgements} {pstd} The main program of this command is a {hi:Stata} adaptation of Li, Chen and Gao (2011) Matlab corresponding original program. I would like to thank Professors Degui Li (Department of Mathematics, University of York), Jia Chen (Department of Economics, University of York) and Jiti Gao (Department of Econometrics and Business Statistics, Monash University) for allowing me to use their Matlab program, and particularly Professor Degui Li for the many fruitful exchanges we had during the building process of the package. I would like also to thank Rasmane Ouedraogo (CERDI, Univeristy of Auvergne) for using and testing previous versions of the command. The usual disclaimers apply: all errors and imperfections in this package are mine and all comments are very welcome. {title:Author} {p 4}Ibrahima Amadou Diallo {p_end} {p 4}CERDI, University of Auvergne {p_end} {p 4}65 bd Francois Mitterrand {p_end} {p 4}63000 Clermont-Ferrand {p_end} {p 4}France {p_end} {p 4}{hi:E-Mail}: {browse "mailto:zavren@gmail.com":zavren@gmail.com} {p_end} {title:Also see} {psee} Online: help for {bf:{help kdensity}}, {bf:{help lowess}}, {bf:{help lpoly}}, {bf:{help mlowess}} (if installed), {bf:{help locpr}} (if installed), {bf:{help kdens}} (if installed) {p_end}