* ***************************************************************** *
* ***************************************************************** *
* File-Name: jwb data generation final.do *
* Date: 1/9/2017 *
* Author: Richard G Vanden Bergh *
* Purpose: Do-file to produce a simulated dataset *
* to be used in "jwb simulated analysis.do" *
* Data Output: "F:\jwb_exp_moderating.dta" *
* Input File: none *
* Output File: none *
* Previous file: None *
* **************************************************************** *
* **************************************************************** *
*version 13
set more off
clear all
* Generate a dataset of 200 observations with three independent variables. We create the variables for illustrative purposes only.
* One independent variable represents Years Experience by a foreign firm in a host country. We assume Years Experience has
* a mean of mu_e years and standard deviation of sigma_e. We draw Years Experience from a truncated normal distribution between [1,20].
* One moderating variable JVpartner is meant to represent an indicator variable equal to 1 if the foreign firm
* has a locally based joint venture partner and 0 otherwise. We draw JVpartner from a uniform distribution.
* A second moderating variable Innovation in this example is meant to represent the general environment
* in the host country affecting innovation. We assume is similar to a measure, by country, that is equal to
* the number of patent applications filed under the United States Patent and Trademark Office (USPTO) system,
* per 10,000 of the country’s population. We assume Innovation is drawn from a truncated normal distrbution with mean mu_i
* and standard deviation of sigma_i between [15, 69]
quietly set obs 200
generate firm_id = (_n)
*set seed to create replicable dataset
quietly set seed 13568
*code to generate truncated normal distribution Years Experience
quietly scalar a_e = 1
quietly scalar b_e = 20
quietly scalar mu_e = 7
quietly scalar sigma_e = 6
quietly generate u_e = runiform()
quietly generate w_e = normal((a_e-mu_e)/sigma_e)+u_e*(normal((b_e-mu_e)/sigma_e)-normal((a_e-mu_e)/sigma_e))
*create Years Experience in years since first opened operations in country
quietly generate Experience = mu_e + sigma_e*invnormal(w_e)
label variable Experience "Years Experience"
summarize Experience
*generate uniformly distributed integer between 0 and 1 to represent local Joint Venture partner
quietly generate JVpartner = int((2)*runiform())
label variable JVpartner "JV Partner"
summarize JVpartner
*code to generate truncated normal distribution for Innovation
quietly scalar a_i = 15
quietly scalar b_i = 69
quietly scalar mu_i = 37
quietly scalar sigma_i = 12
quietly generate u_i = runiform()
quietly generate w_i = normal((a_i-mu_i)/sigma_i)+u_i*(normal((b_i-mu_i)/sigma_i)-normal((a_i-mu_i)/sigma_i))
*create Innovation for host country
quietly generate Innovation = mu_i + sigma_i*invnormal(w_i)
label variable Innovation "Innovation"
summarize Innovation
save "F:\jwb_exp_moderating.dta", replace
*to generate the descriptive statistics presented in Tables 1a and 4b in the paper
tabstat Experience JVpartner Innovation, statistics(mean sd min max n) columns(statistics) format(%9.2f)
exit