Web view*Igual con Dy de tamaño más grande (gen Dy = L.L.L.L.L.y - y). *TAREAS...
Transcript of Web view*Igual con Dy de tamaño más grande (gen Dy = L.L.L.L.L.y - y). *TAREAS...
*HAY QUE CREAR UN DIRECTORIO tempdir ANTES DE CORRER ESTE .DO COMPLETO.
*También, antes de correr regresiones, hay que definir los global tempdir, dir, P1G, ... , P20G, Pt
global tempdir "c:\temp\temp\"
*global tempdir "Y:\Documentos\Maestría\Tesina\TempStata\"
global dir "c:\temp\"
*global dir "Y:\Documentos\Maestría\Tesina\"
*AL FINAL DE ESTE .do HAY INSTRUCCIONES SOBRE CÓMO PROSEGUIR.
*TAREAS RECIENTEMENTE TERMINADAS.
*No de 100, mejor de 1000. Más de 21,000 regresiones.
*Resolución de seis dígitos. No, ... mejor de siete.
*Los países están todos completos sólo a partir de 1946.
*Entre dropear a los países problemáticos (estos países son los que tenían mejor F simulada que la real) y dropear los años problemáticos, preferí lo segundo.
*Para el no-aleatorio:
*Correrla resagada 3. Pare que las bases tengan el mismo tamaño, cuidar que L.L.L.y no pierda los primeros tres datos.
*También con F.F.F. De -6 a 6.
*Calcular varianza de Dy por país y ver si se correlacionan con las F altas.
*Igual con Dy de tamaño más grande (gen Dy = L.L.L.L.L.y - y).
*TAREAS INMEDIATAS
*Para el no-aleatorio:
*Analizar la distribución de las betas significativas.
*Pensar en una objeción seria por el lado de ¿qué controles nos faltan? ¿Qué otras críticas?
* Corregir Dur y NReg para que sumen 100 (llenarlo de unos y ver qué pasó con los países 6, 10 y 13).
*TAREAS NO-URGENTES
*Añadir dummies de presidentes gringos sólo para la regresión grande.
*Hacer 1000 simulaciones con pool de periodos de *todos* los países.
*INTENTOS POR HACER QUE LAS DUMMIES REALES SEAN MEJORES QUE LAS SIMULADAS:
*Quitar los decimales a las reales.
*No cambió ni una F.
*Quitar las variabies cero de las simuladas.
*No cambia nada: de cualquier forma Stata las dropea.
*Bug: Decía <1945, lo corregí con <= 1945.
*Los datos cambiaron un poco. Aún no sé si mejoraron.
*Bug: Las simulaciones podían tener datos más allá de G33. Corregí todo para que todas las regresiones (reales y simuladas) llegaran hasta G40.
*Los datos cambiaron un poco. Aún no sé si mejoraron.
*Verificar que las simuladas tengan más o menos la misma cantidad de variables-no-cero que las simuladas.
***1***
*Capítulo 1, Regímenes
global P1G "P1G1 P1G2 P1G3 P1G4 P1G5 P1G6 P1G7 P1G8 P1G9 P1G10 P1G11 P1G12 P1G13 P1G14 P1G15 P1G16 P1G17 P1G18 P1G19 P1G20 P1G21 P1G22 P1G23 P1G24 P1G25 P1G26 P1G27 P1G28 P1G29 P1G30 P1G31 P1G32 P1G33 P1G34 P1G35 P1G36 P1G37 P1G38 P1G39 P1G40"
global P2G "P2G1 P2G2 P2G3 P2G4 P2G5 P2G6 P2G7 P2G8 P2G9 P2G10 P2G11 P2G12 P2G13 P2G14 P2G15 P2G16 P2G17 P2G18 P2G19 P2G20 P2G21 P2G22 P2G23 P2G24 P2G25 P2G26 P2G27 P2G28 P2G29 P2G30 P2G31 P2G32 P2G33 P2G34 P2G35 P2G36 P2G37 P2G38 P2G39 P2G40"
global P3G "P3G1 P3G2 P3G3 P3G4 P3G5 P3G6 P3G7 P3G8 P3G9 P3G10 P3G11 P3G12 P3G13 P3G14 P3G15 P3G16 P3G17 P3G18 P3G19 P3G20 P3G21 P3G22 P3G23 P3G24 P3G25 P3G26 P3G27 P3G28 P3G29 P3G30 P3G31 P3G32 P3G33 P3G34 P3G35 P3G36 P3G37 P3G38 P3G39 P3G40"
global P4G "P4G1 P4G2 P4G3 P4G4 P4G5 P4G6 P4G7 P4G8 P4G9 P4G10 P4G11 P4G12 P4G13 P4G14 P4G15 P4G16 P4G17 P4G18 P4G19 P4G20 P4G21 P4G22 P4G23 P4G24 P4G25 P4G26 P4G27 P4G28 P4G29 P4G30 P4G31 P4G32 P4G33 P4G34 P4G35 P4G36 P4G37 P4G38 P4G39 P4G40"
global P5G "P5G1 P5G2 P5G3 P5G4 P5G5 P5G6 P5G7 P5G8 P5G9 P5G10 P5G11 P5G12 P5G13 P5G14 P5G15 P5G16 P5G17 P5G18 P5G19 P5G20 P5G21 P5G22 P5G23 P5G24 P5G25 P5G26 P5G27 P5G28 P5G29 P5G30 P5G31 P5G32 P5G33 P5G34 P5G35 P5G36 P5G37 P5G38 P5G39 P5G40"
global P6G "P6G1 P6G2 P6G3 P6G4 P6G5 P6G6 P6G7 P6G8 P6G9 P6G10 P6G11 P6G12 P6G13 P6G14 P6G15 P6G16 P6G17 P6G18 P6G19 P6G20 P6G21 P6G22 P6G23 P6G24 P6G25 P6G26 P6G27 P6G28 P6G29 P6G30 P6G31 P6G32 P6G33 P6G34 P6G35 P6G36 P6G37 P6G38 P6G39 P6G40"
global P7G "P7G1 P7G2 P7G3 P7G4 P7G5 P7G6 P7G7 P7G8 P7G9 P7G10 P7G11 P7G12 P7G13 P7G14 P7G15 P7G16 P7G17 P7G18 P7G19 P7G20 P7G21 P7G22 P7G23 P7G24 P7G25 P7G26 P7G27 P7G28 P7G29 P7G30 P7G31 P7G32 P7G33 P7G34 P7G35 P7G36 P7G37 P7G38 P7G39 P7G40"
global P8G "P8G1 P8G2 P8G3 P8G4 P8G5 P8G6 P8G7 P8G8 P8G9 P8G10 P8G11 P8G12 P8G13 P8G14 P8G15 P8G16 P8G17 P8G18 P8G19 P8G20 P8G21 P8G22 P8G23 P8G24 P8G25 P8G26
P8G27 P8G28 P8G29 P8G30 P8G31 P8G32 P8G33 P8G34 P8G35 P8G36 P8G37 P8G38 P8G39 P8G40"
global P9G "P9G1 P9G2 P9G3 P9G4 P9G5 P9G6 P9G7 P9G8 P9G9 P9G10 P9G11 P9G12 P9G13 P9G14 P9G15 P9G16 P9G17 P9G18 P9G19 P9G20 P9G21 P9G22 P9G23 P9G24 P9G25 P9G26 P9G27 P9G28 P9G29 P9G30 P9G31 P9G32 P9G33 P9G34 P9G35 P9G36 P9G37 P9G38 P9G39 P9G40"
global P10G "P10G1 P10G2 P10G3 P10G4 P10G5 P10G6 P10G7 P10G8 P10G9 P10G10 P10G11 P10G12 P10G13 P10G14 P10G15 P10G16 P10G17 P10G18 P10G19 P10G20 P10G21 P10G22 P10G23 P10G24 P10G25 P10G26 P10G27 P10G28 P10G29 P10G30 P10G31 P10G32 P10G33 P10G34 P10G35 P10G36 P10G37 P10G38 P10G39 P10G40"
global P11G "P11G1 P11G2 P11G3 P11G4 P11G5 P11G6 P11G7 P11G8 P11G9 P11G10 P11G11 P11G12 P11G13 P11G14 P11G15 P11G16 P11G17 P11G18 P11G19 P11G20 P11G21 P11G22 P11G23 P11G24 P11G25 P11G26 P11G27 P11G28 P11G29 P11G30 P11G31 P11G32 P11G33 P11G34 P11G35 P11G36 P11G37 P11G38 P11G39 P11G40"
global P12G "P12G1 P12G2 P12G3 P12G4 P12G5 P12G6 P12G7 P12G8 P12G9 P12G10 P12G11 P12G12 P12G13 P12G14 P12G15 P12G16 P12G17 P12G18 P12G19 P12G20 P12G21 P12G22 P12G23 P12G24 P12G25 P12G26 P12G27 P12G28 P12G29 P12G30 P12G31 P12G32 P12G33 P12G34 P12G35 P12G36 P12G37 P12G38 P12G39 P12G40"
global P13G "P13G1 P13G2 P13G3 P13G4 P13G5 P13G6 P13G7 P13G8 P13G9 P13G10 P13G11 P13G12 P13G13 P13G14 P13G15 P13G16 P13G17 P13G18 P13G19 P13G20 P13G21 P13G22 P13G23 P13G24 P13G25 P13G26 P13G27 P13G28 P13G29 P13G30 P13G31 P13G32 P13G33 P13G34 P13G35 P13G36 P13G37 P13G38 P13G39 P13G40"
global P14G "P14G1 P14G2 P14G3 P14G4 P14G5 P14G6 P14G7 P14G8 P14G9 P14G10 P14G11 P14G12 P14G13 P14G14 P14G15 P14G16 P14G17 P14G18 P14G19 P14G20 P14G21 P14G22 P14G23 P14G24 P14G25 P14G26 P14G27 P14G28 P14G29 P14G30 P14G31 P14G32 P14G33 P14G34 P14G35 P14G36 P14G37 P14G38 P14G39 P14G40"
global P15G "P15G1 P15G2 P15G3 P15G4 P15G5 P15G6 P15G7 P15G8 P15G9 P15G10 P15G11 P15G12 P15G13 P15G14 P15G15 P15G16 P15G17 P15G18 P15G19 P15G20 P15G21 P15G22 P15G23 P15G24 P15G25 P15G26 P15G27 P15G28 P15G29 P15G30 P15G31 P15G32 P15G33 P15G34 P15G35 P15G36 P15G37 P15G38 P15G39 P15G40"
global P16G "P16G1 P16G2 P16G3 P16G4 P16G5 P16G6 P16G7 P16G8 P16G9 P16G10 P16G11 P16G12 P16G13 P16G14 P16G15 P16G16 P16G17 P16G18 P16G19 P16G20 P16G21 P16G22 P16G23 P16G24 P16G25 P16G26 P16G27 P16G28 P16G29 P16G30 P16G31 P16G32 P16G33 P16G34 P16G35 P16G36 P16G37 P16G38 P16G39 P16G40"
global P17G "P17G1 P17G2 P17G3 P17G4 P17G5 P17G6 P17G7 P17G8 P17G9 P17G10 P17G11 P17G12 P17G13 P17G14 P17G15 P17G16 P17G17 P17G18 P17G19 P17G20 P17G21 P17G22
P17G23 P17G24 P17G25 P17G26 P17G27 P17G28 P17G29 P17G30 P17G31 P17G32 P17G33 P17G34 P17G35 P17G36 P17G37 P17G38 P17G39 P17G40"
global P18G "P18G1 P18G2 P18G3 P18G4 P18G5 P18G6 P18G7 P18G8 P18G9 P18G10 P18G11 P18G12 P18G13 P18G14 P18G15 P18G16 P18G17 P18G18 P18G19 P18G20 P18G21 P18G22 P18G23 P18G24 P18G25 P18G26 P18G27 P18G28 P18G29 P18G30 P18G31 P18G32 P18G33 P18G34 P18G35 P18G36 P18G37 P18G38 P18G39 P18G40"
global P19G "P19G1 P19G2 P19G3 P19G4 P19G5 P19G6 P19G7 P19G8 P19G9 P19G10 P19G11 P19G12 P19G13 P19G14 P19G15 P19G16 P19G17 P19G18 P19G19 P19G20 P19G21 P19G22 P19G23 P19G24 P19G25 P19G26 P19G27 P19G28 P19G29 P19G30 P19G31 P19G32 P19G33 P19G34 P19G35 P19G36 P19G37 P19G38 P19G39 P19G40"
global P20G "P20G1 P20G2 P20G3 P20G4 P20G5 P20G6 P20G7 P20G8 P20G9 P20G10 P20G11 P20G12 P20G13 P20G14 P20G15 P20G16 P20G17 P20G18 P20G19 P20G20 P20G21 P20G22 P20G23 P20G24 P20G25 P20G26 P20G27 P20G28 P20G29 P20G30 P20G31 P20G32 P20G33 P20G34 P20G35 P20G36 P20G37 P20G38 P20G39 P20G40"
global Pt "P1t P2t P3t P4t P5t P6t P7t P8t P9t P10t P11t P12t P13t P14t P15t P16t P17t P18t P19t P20t"
clear
set more off, perm
set mem 200m, perm
set maxvar 25000, perm
use "$dir\fechachristian.dta", clear
*SALVAR PRIMERO LAS GOB Y LUEGO LAS PRIMERAS DOS COLUMNAS.
ren var34 c
destring c, replace
ren var35 fechachristian
destring fechachristian, replace
renpfix var g
gen year = floor(fechachristian)
sort c year
by c year: gen n = _n
drop if n > 1
drop n
gen gob = fechachristian - year
*drop fechachristian
ren c numpais
*reshape wide gob, i(numpais) j(year)
save "$dir\fechachristian2.dta", replace
use "$dir\OxfordLatAm.dta", clear
sort numpais year
merge numpais year using "$dir\fechachristian2.dta"
drop _merge
*gen p1g1 = 0
*if year <= fechachristian replace p1g1 = 1
*browse numpais year gob*
*gen g1=0
*replace g1=1 if
tsset numpais year
*Genero una variable a la que a cada año le asigna la fecha en que inició su régimen (en 1999 vivíamos en un régimen que inició en 1994).
#delimit ;
by numpais: gen regimen = max(
fechachristian,
L.fechachristian,
L.L.fechachristian,
L.L.L.fechachristian,
L.L.L.L.fechachristian,
L.L.L.L.L.fechachristian,
L.L.L.L.L.L.fechachristian,
L.L.L.L.L.L.L.fechachristian,
L.L.L.L.L.L.L.L.fechachristian,
L.L.L.L.L.L.L.L.L.fechachristian,
L.L.L.L.L.L.L.L.L.L.fechachristian,
L.L.L.L.L.L.L.L.L.L.L.fechachristian,
L.L.L.L.L.L.L.L.L.L.L.L.fechachristian,
L.L.L.L.L.L.L.L.L.L.L.L.L.fechachristian,
L.L.L.L.L.L.L.L.L.L.L.L.L.L.fechachristian,
L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.fechachristian,
L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.fechachristian,
L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.fechachristian,
L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.fechachristian,
L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.fechachristian,
L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.fechachristian,
L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.fechachristian,
L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.fechachristian,
L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.fechachristian,
L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.fechachristian,
L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.fechachristian,
L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.fechachristian,
L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.fechachristian,
L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.fechachristian,
L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.fechachristian,
L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.fechachristian,
L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.fechachristian,
L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.fechachristian
);
#delimit cr
replace regimen = 1900 if regimen ==.
forvalues i = 1(1)33 {
by numpais: egen G`i' = max(g`i')
by numpais: replace G`i' = 1 if (regimen<=year) & G`i' > year
replace G`i' = 0 if G`i' > 2
}
forvalues j = 1(1)33 {
drop g`j'
}
*Ceros por abajo
forvalues k = 2(1)33 {
replace G`k' = 0 if G1 > 0
}
forvalues k = 3(1)33 {
replace G`k' = 0 if G2 > 0
}
forvalues k = 4(1)33 {
replace G`k' = 0 if G3 > 0
}
forvalues k = 5(1)33 {
replace G`k' = 0 if G4 > 0
}
forvalues k = 6(1)33 {
replace G`k' = 0 if G5 > 0
}
forvalues k = 7(1)33 {
replace G`k' = 0 if G6 > 0
}
forvalues k = 8(1)33 {
replace G`k' = 0 if G7 > 0
}
forvalues k = 9(1)33 {
replace G`k' = 0 if G8 > 0
}
forvalues k = 10(1)33 {
replace G`k' = 0 if G9 > 0
}
forvalues k = 11(1)33 {
replace G`k' = 0 if G10 > 0
}
forvalues k = 12(1)33 {
replace G`k' = 0 if G11 > 0
}
forvalues k = 13(1)33 {
replace G`k' = 0 if G12 > 0
}
forvalues k = 14(1)33 {
replace G`k' = 0 if G13 > 0
}
forvalues k = 15(1)33 {
replace G`k' = 0 if G14 > 0
}
forvalues k = 16(1)33 {
replace G`k' = 0 if G15 > 0
}
forvalues k = 17(1)33 {
replace G`k' = 0 if G16 > 0
}
forvalues k = 18(1)33 {
replace G`k' = 0 if G17 > 0
}
forvalues k = 19(1)33 {
replace G`k' = 0 if G18 > 0
}
forvalues k = 20(1)33 {
replace G`k' = 0 if G19 > 0
}
forvalues k = 21(1)33 {
replace G`k' = 0 if G20 > 0
}
forvalues k = 22(1)33 {
replace G`k' = 0 if G21 > 0
}
forvalues k = 23(1)33 {
replace G`k' = 0 if G22 > 0
}
forvalues k = 24(1)33 {
replace G`k' = 0 if G23 > 0
}
forvalues k = 25(1)33 {
replace G`k' = 0 if G24 > 0
}
forvalues k = 26(1)33 {
replace G`k' = 0 if G25 > 0
}
forvalues k = 27(1)33 {
replace G`k' = 0 if G26 > 0
}
forvalues k = 28(1)33 {
replace G`k' = 0 if G27 > 0
}
forvalues k = 29(1)33 {
replace G`k' = 0 if G28 > 0
}
forvalues k = 30(1)33 {
replace G`k' = 0 if G29 > 0
}
forvalues k = 31(1)33 {
replace G`k' = 0 if G30 > 0
}
forvalues k = 32(1)33 {
replace G`k' = 0 if G31 > 0
}
forvalues k = 33(1)33 {
replace G`k' = 0 if G32 > 0
}
*Añade prefijos P1, P2...
forvalues l = 1(1)20 {
forvalues m = 1(1)33 {
gen P`l'G`m' = G`m' if numpais==`l'
replace P`l'G`m' = 0 if P`l'G`m' == .
}
}
drop G*
*Dummy de cambio de régimen (cr).
gen cr=0
replace cr=1 if fechachristian!=.
replace P1G6 = .150 in 45
replace P1G7 = .85 in 45
replace P1G7 = .15 in 47
replace P1G8 = .5 in 47
replace P1G8 = 385 in 47
replace P1G8 = .85 in 47
replace P1G8 = .15 in 49
replace P1G8 = .16 in 50
replace P1G10 = .84 in 50
replace P1G11 = .67 in 56
replace P1G12 = .33 in 56
replace P1G12 = .67 in 57
replace P1G13 = .33 in 57
replace P1G13 = .08 in 59
replace P1G14 = .92 in 59
replace P1G14 = .25 in 63
replace P1G15 = .75 in 63
replace P1G15 = 0 in 63
replace P1G16 = .75 in 63
replace P1G16 = 1 in 64
replace P1G15 = .75 in 63
replace P1G16 = 0 in 63
replace P1G15 = .5 in 64
replace P1G16 = .5 in 64
replace P1G16 = .67 in 67
replace P1G17 = .33 in 67
replace P1G18 = .4 in 74
replace P1G21 = .6 in 74
replace P1G21 = 1 in 75
replace P1G22 = 1 in 77
replace P1G22 = .25 in 82
replace P1G23 = .75 in 82
replace P1G22 = .16 in 82
replace P1G23 = .84 in 82
replace P1G23 = .25 in 83
replace P1G24 = .75 in 83
replace P1G24 = .75 in 84
replace P1G25 = .25 in 84
replace P1G25 = .41 in 86
replace P1G26 = .59 in 86
replace P1G26 = .33 in 90
replace P1G27 = .67 in 90
replace P1G29 = .75 in 100
replace P1G30 = .25 in 100
drop if year==1900
replace P2G2 = .910 in 104
replace P2G3 = .09 in 104
replace P2G8 = .5 in 138
replace P2G9 = .5 in 138
replace P2G9 = .25 in 139
replace P2G10 = .75 in 139
replace P2G11 = .910 in 143
replace P2G12 = .09 in 143
replace P2G12 = .5 in 146
replace P2G13 = .5 in 146
replace P2G13 = .33 in 151
replace P2G14 = .57 in 151
replace P2G14 = .25 in 152
replace P2G15 = .75 in 152
replace P2G18 = .83 in 164
replace P2G19 = .17 in 164
replace P2G19 = .5 in 166
replace P2G20 = .5 in 166
replace P2G20 = .75 in 167
replace P2G21 = .25 in 167
replace P2G21 = .25 in 169
replace P2G22 = .25 in 169
replace P2G22 = .58 in 171
replace P2G23 = .42 in 171
replace P2G27 = .75 in 182
replace P2G28 = .25 in 182
replace P2G28 = .58 in 185
replace P2G29 = .42 in 185
replace P2G29 = .33 in 189
replace P2G30 = .57 in 189
replace P2G30 = .67 in 189
replace P2G14 = .67 in 151
replace P2G31 = .5 in 193
replace P2G32 = .5 in 193
replace P2G32 = .75 in 196
replace P2G33 = .25 in 196
replace P2G33 = 1 in 197
replace P2G33 = 1 in 198
replace P2G33 = 1 in 199
replace P2G33 = 1 in 200
replace P3G5 = .5 in 224
replace P3G6 = .5 in 224
replace P3G7 = .16 in 230
replace P3G8 = .84 in 230
replace P3G10 = .54 in 234
replace P3G11 = .46 in 234
replace P3G14 = .67 in 252
replace P3G15 = .33 in 252
replace P3G15 = .65 in 254
replace P3G16 = .35 in 254
replace P3G17 = .67 in 261
replace P3G18 = .33 in 261
replace P3G18 = .25 in 264
replace P3G19 = .75 in 264
replace P3G20 = .91 in 268
replace P3G21 = .9 in 268
replace P3G21 = .75 in 269
replace P3G22 = .25 in 269
replace P3G25 = .83 in 279
replace P3G26 = .17 in 279
replace P3G27 = .75 in 288
replace P3G28 = .25 in 288
replace P3G28 = .91 in 289
replace P3G29 = .9 in 289
replace P3G29 = .09 in 289
replace P3G21 = .09 in 268
replace P3G29 = .99 in 292
replace P3G30 = .01 in 292
replace P3G30 = .75 in 294
replace P3G31 = .25 in 294
replace P4G13 = .25 in 347
replace P4G14 = .75 in 347
replace P4G19 = .7 in 373
replace P4G20 = .3 in 373
replace P4G24 = .83 in 384
replace P4G25 = .17 in 384
replace P4G26 = .58 in 388
replace P4G27 = .42 in 388
replace P4G27 = .91 in 389
replace P4G28 = .09 in 389
replace P4G28 = .91 in 393
replace P4G29 = .09 in 393
replace P4G31 = .16 in 398
replace P4G32 = .84 in 398
replace P5G7 = .27 in 448
replace P5G8 = .73 in 448
replace P5G8 = .58 in 450
replace P5G9 = .42 in 450
replace P5G9 = .58 in 454
replace P5G10 = .42 in 454
replace P5G10 = .75 in 456
replace P5G11 = .25 in 456
replace P5G11 = .33 in 457
replace P5G12 = .67 in 457
replace P5G12 = .08 in 458
replace P5G13 = .92 in 458
replace P5G21 = .33 in 484
replace P5G22 = .67 in 484
replace P5G22 = .6 in 486
replace P5G23 = .4 in 486
replace P5G23 = .33 in 490
replace P5G24 = .67 in 490
replace P5G24 = .5 in 491
replace P5G25 = .5 in 491
replace P5G25 = .5 in 494
replace P5G26 = .5 in 494
replace P5G27 = .04 in 499
replace P5G28 = .96 in 499
replace P7G5 = .81 in 662
replace P7G6 = .19 in 662
replace P7G9 = .58 in 694
replace P7G10 = .42 in 694
replace P7G10 = .15 in 696
replace P7G11 = .85 in 696
replace P8G2 = .91 in 716
replace P8G3 = .09 in 716
replace P8G3 = .16 in 724
replace P8G4 = .84 in 724
replace P8G11 = .4 in 761
replace P8G12 = .6 in 761
replace P8G12 = .04 in 762
replace P8G13 = .96 in 762
replace P8G13 = .16 in 763
replace P8G14 = .84 in 763
replace P8G14 = .31 in 765
replace P8G15 = .69 in 765
replace P8G17 = .69 in 765
replace P8G15 = 0 in 765
replace P8G16 = .69 in 765
replace P8G16 = 1 in 766
replace P8G17 = 0 in 765
replace P8G26 = .41 in 796
replace P8G27 = .59 in 796
replace P9G11 = .41 in 848
replace P9G12 = .59 in 848
replace P9G16 = .83 in 861
replace P9G17 = .17 in 861
replace P9G17 = .5 in 863
replace P9G18 = .5 in 863
replace P9G19 = .5 in 865
replace P9G20 = .5 in 866
replace P9G20 = .5 in 865
replace P9G20 = .25 in 866
replace P9G21 = .75 in 866
replace P9G21 = .33 in 867
replace P9G22 = .67 in 867
replace P9G22 = .41 in 868
replace P9G24 = .59 in 868
replace P9G25 = .08 in 872
replace P9G26 = .92 in 872
replace P9G29 = .33 in 881
replace P9G30 = .67 in 881
replace P9G30 = .33 in 884
replace P9G31 = .67 in 884
replace P9G32 = .33 in 888
replace P9G33 = .67 in 888
replace P9G33 = 1 in 892
replace P9G33 = 1 in 893
replace P9G33 = 1 in 894
replace P9G33 = 1 in 895
replace P9G33 = 1 in 896
replace P9G33 = 1 in 897
replace P9G33 = 1 in 898
replace P9G33 = 1 in 899
replace P9G33 = 1 in 900
replace P10G7 = .04 in 962
replace P10G8 = .96 in 962
replace P10G11 = .91 in 980
replace P10G12 = .09 in 980
replace P10G12 = .16 in 982
replace P10G13 = .84 in 982
replace P10G13 = .97 in 983
replace P10G14 = .03 in 983
replace P10G14 = .33 in 984
replace P10G15 = .67 in 984
replace P10G15 = .75 in 986
replace P10G16 = .25 in 986
replace P10G18 = .25 in 994
replace P10G19 = .75 in 994
replace P10G19 = .16 in 997
replace P10G20 = .84 in 997
replace P10G20 = .16 in 1000
replace P10G21 = .84 in 1000
replace P11G4 = .08 in 1031
replace P11G5 = .92 in 1031
replace P11G6 = .41 in 1044
replace P11G7 = .59 in 1044
replace P11G7 = .16 in 1045
replace P11G8 = .84 in 1045
replace P11G8 = 1 in 1046
replace P11G8 = 0 in 1046
replace P11G9 = .16 in 1051
replace P11G10 = .84 in 1051
replace P11G10 = .08 in 1053
replace P11G11 = .92 in 1053
replace P11G11 = .46 in 1054
replace P11G12 = .54 in 1054
replace P11G12 = .09 in 1056
replace P11G13 = .91 in 1056
replace P11G13 = .17 in 1058
replace P11G14 = .83 in 1058
replace P11G14 = .16 in 1063
replace P11G15 = .84 in 1063
replace P11G21 = .22 in 1082
replace P11G22 = .78 in 1082
replace P11G22 = .6 in 1083
replace P11G23 = .4 in 1083
replace P11G23 = .91 in 1085
replace P11G24 = .09 in 1085
replace P11G25 = .33 in 1093
replace P11G26 = .67 in 1093
replace P11G26 = .4 in 1093
replace P11G27 = .27 in 1093
replace P11G28 = .04 in 1096
replace P11G29 = .96 in 1096
replace P11G29 = .83 in 1099
replace P11G30 = .17 in 1099
replace P12G5 = .62 in 1134
replace P12G6 = .38 in 1134
replace P12G7 = .03 in 1146
replace P12G8 = .97 in 1146
replace P12G8 = .87 in 1149
replace P12G9 = .13 in 1149
replace P12G9 = .83 in 1150
replace P12G10 = .17 in 1150
replace P12G10 = .95 in 1156
replace P12G11 = .05 in 1156
replace P12G11 = .67 in 1157
replace P12G12 = .33 in 1157
replace P12G12 = .33 in 1158
replace P12G13 = .67 in 1158
replace P12G13 = .27 in 1161
replace P12G14 = .73 in 1161
replace P12G15 = .3 in 1171
replace P12G16 = .7 in 1171
replace P12G17 = 1 in 1186
replace P12G17 = .16 in 1187
replace P12G18 = .84 in 1187
replace P12G18 = 1 in 1188
replace P12G18 = .41 in 1188
replace P12G19 = .59 in 1188
replace P12G20 = .16 in 1190
replace P12G21 = .84 in 1190
replace P12G21 = .08 in 1191
replace P12G22 = .82 in 1191
replace P12G22 = .92 in 1191
replace P12G23 = .41 in 1193
replace P12G24 = .59 in 1193
replace P12G24 = .67 in 1194
replace P12G25 = .33 in 1194
replace P12G25 = .25 in 1195
replace P12G26 = .75 in 1195
replace P12G26 = .08 in 1196
replace P12G27 = .92 in 1196
replace P12G26 = 0 in 1197
replace P12G26 = 0 in 1198
replace P12G26 = 0 in 1199
replace P12G27 = 1 in 1197
replace P12G27 = 1 in 1198
replace P12G27 = 1 in 1199
replace P12G27 = .04 in 1200
replace P12G28 = .96 in 1200
replace P13G12 = .83 in 1281
replace P13G13 = .17 in 1281
replace P13G13 = .04 in 1282
replace P13G14 = .96 in 1282
replace P13G16 = .83 in 1293
replace P13G17 = .17 in 1293
replace P13G17 = .83 in 1297
replace P13G18 = .17 in 1297
replace P14G1 = .89 in 1310
replace P14G2 = .11 in 1310
replace P14G2 = .39 in 1311
replace P14G3 = .61 in 1311
replace P14G3 = .13 in 1313
replace P14G4 = .87 in 1313
replace P14G4 = .42 in 1314
replace P14G5 = .58 in 1314
replace P14G5 = .1 in 1317
replace P14G6 = .9 in 1317
replace P14G6 = .39 in 1320
replace P14G7 = .61 in 1320
replace P14G9 = .27 in 1338
replace P14G10 = .73 in 1338
replace P15G10 = .58 in 1471
replace P15G11 = .42 in 1471
replace P15G11 = .08 in 1472
replace P15G12 = .92 in 1472
replace P15G13 = .08 in 1478
replace P15G14 = .92 in 1478
replace P15G14 = .54 in 1479
replace P15G15 = .56 in 1479
replace P15G16 = .83 in 1484
replace P15G17 = .17 in 1484
replace P15G18 = .16 in 1488
replace P15G19 = .84 in 1488
replace P15G19 = .08 in 1490
replace P15G20 = .92 in 1490
replace P15G21 = .75 in 1496
replace P15G22 = .25 in 1496
replace P16G1 = .84 in 1503
replace P16G2 = .16 in 1503
replace P16G22 = .75 in 1579
replace P16G23 = .25 in 1579
replace P16G25 = .33 in 1584
replace P16G26 = .67 in 1584
replace P16G27 = .33 in 1589
replace P16G28 = .67 in 1589
replace P16G29 = .83 in 1592
replace P16G30 = .17 in 1592
replace P16G30 = .33 in 1594
replace P16G31 = .67 in 1594
replace P16G31 = 1 in 1599
replace P17G12 = .16 in 1651
replace P17G13 = .84 in 1651
replace P17G13 = .13 in 1653
replace P17G14 = .87 in 1653
replace P17G14 = .41 in 1653
replace P17G15 = .46 in 1653
replace P17G15 = .34 in 1654
replace P17G16 = .66 in 1654
replace P17G19 = .08 in 1689
replace P17G20 = .92 in 1689
replace P17G21 = .33 in 1693
replace P17G22 = .67 in 1693
replace P17G22 = .16 in 1698
replace P17G23 = .86 in 1698
replace P17G23 = .84 in 1698
replace P17G23 = .24 in 1699
replace P17G24 = .76 in 1699
replace P18G8 = .27 in 1733
replace P18G9 = .73 in 1733
replace P18G11 = .75 in 1748
replace P18G12 = .25 in 1748
replace P18G15 = .16 in 1763
replace P18G16 = .84 in 1763
replace P18G17 = .76 in 1768
replace P18G18 = .24 in 1768
replace P18G20 = .66 in 1775
replace P18G21 = .34 in 1775
replace P18G26 = .25 in 1792
replace P18G27 = .75 in 1792
replace P18G27 = .75 in 1793
replace P18G28 = .25 in 1793
replace P18G31 = .25 in 1800
replace P19G9 = .83 in 1866
replace P19G10 = .17 in 1866
replace P19G10 = .41 in 1867
replace P19G11 = .59 in 1867
replace P19G11 = .16 in 1869
replace P19G12 = .84 in 1869
replace P19G12 = .08 in 1872
replace P19G13 = .92 in 1872
replace P19G13 = .25 in 1872
replace P19G14 = .67 in 1872
replace P19G14 = .08 in 1873
replace P19G15 = .61 in 1873
replace P19G16 = .31 in 1873
replace P19G16 = .83 in 1880
replace P19G17 = .17 in 1880
replace P19G17 = .67 in 1881
replace P19G18 = .33 in 1881
replace P19G18 = .83 in 1884
replace P19G19 = .17 in 1884
replace P19G19 = .16 in 1885
replace P19G20 = .84 in 1885
replace P19G20 = .83 in 1889
replace P19G21 = .17 in 1889
replace P20G2 = .5 in 1907
replace P20G3 = .5 in 1907
replace P20G7 = .92 in 1931
replace P20G8 = .08 in 1931
replace P20G11 = .08 in 1948
replace P20G12 = .92 in 1948
replace P20G12 = .87 in 1950
replace P20G13 = .13 in 1950
replace P20G13 = .92 in 1952
replace P20G14 = .08 in 1952
replace P20G14 = .28 in 1953
replace P20G15 = .72 in 1953
replace P20G15 = .06 in 1958
replace P20G16 = .94 in 1958
replace P20G16 = .91 in 1958
replace P20G17 = .03 in 1958
replace P20G17 = .06 in 1961
replace P20G18 = .94 in 1961
replace P20G18 = .75 in 1966
replace P20G19 = .25 in 1966
replace P20G19 = .91 in 1968
replace P20G20 = .09 in 1968
replace P20G24 = .91 in 1983
replace P20G25 = .09 in 1983
replace P20G26 = .08 in 1989
replace P20G27 = .92 in 1989
replace P20G27 = .08 in 1992
replace P20G28 = .92 in 1992
replace P20G28 = .91 in 1993
replace P20G29 = .09 in 1993
replace P20G29 = .08 in 1999
replace P20G30 = .91 in 1999
replace P20G31 = .01 in 1999
replace gdp = 1000*gdp if (pais=="Mexico" & year > 1992)
drop gdp
ren gdp1970 gdp
*edit numpais pais year P19*
sort year
merge year using "$dir\EEUU.dta"
replace gdpUSA = gdpUSA/1000
replace popUSA = popUSA/1000
*browse pais numpais year gdp pop gdpUSA popUSA DGy
sort numpais year
gen y = ln(gdp/pop)
gen Dy = y - L.y
*Variables abandonadas:
gen gdppc = gdp/pop
gen gdppcUSA = gdpUSA/popUSA
*gen DGgdp = ln((gdppc - L.gdppc)/L.gdppc) - ln((gdppcUSA - L.gdppcUSA)/L.gdppcUSA)
gen Ggdppc = ln(gdppc/gdppcUSA)
gen DGgdppc = Ggdppc - L.Ggdppc
*gen nat = ln((L.pop - pop)/L.pop)
*gen comm = exp + imp
*forvalues n = 1(1)20 {
* gen USAy`n'=USA`n' * ln(gdppc)
*}
*forvalues l = 1(1)20 {
* forvalues m = 1(1)33 {
* gen P`l'G`m'y = P`l'G`m'*ln(gdppc)
* }
*}
forvalues L = 1(1)20 {
gen DtxD`L' = (year-regimen)*(P`L'G1 + P`L'G2 + P`L'G3 + P`L'G4 + P`L'G5 + P`L'G6 + P`L'G7 + P`L'G8 + P`L'G9 + P`L'G10 + P`L'G11 + P`L'G12 + P`L'G13 + P`L'G14 + P`L'G15 + P`L'G16 + P`L'G17 + P`L'G18 + P`L'G19 + P`L'G20 + P`L'G21 + P`L'G22 + P`L'G23 + P`L'G24 + P`L'G25 + P`L'G26 + P`L'G27 + P`L'G28 + P`L'G29 + P`L'G30 + P`L'G31 + P`L'G32 + P`L'G33)
}
ren usareg USAreg
gen USADtxD = (year-USAreg)*(USA1+USA2+USA3+USA4+USA5+USA6+USA7+USA8+USA9+USA10+USA11+USA12+USA13+USA14+USA15+USA16+USA17+USA18+USA19+USA20)
gen Ly = L.y
gen yLy = year*L.y
xi i.numpais*Ly, noomit prefix(x)
drop xnump*
renpfix xnumX
gen year2 = year*year
gen t = year-1900
sort t numpais
keep Dy y P* t pais numpais year
*Agrego variables de ceros para que esta base tenga el mismo tamaño que las bases simuladas.
forvalues p = 1(1)20 {
forvalues g = 34(1)40 {
gen P`p'G`g' = 0
}
}
saveold "$dir\100 (datos&dummies).dta", replace
drop P*
save "$dir\100 (datos).dta", replace
***2***
*Capítulo 2, 1000
clear
forvalues s = 1(1)1000{
clear
#delimit ;
matrix input NReg=(28, 32, 30, 30, 26, 16, 10, 26, 37, 19, 28, 25, 16, 20, 20, 30, 22, 29, 21, 29);
matrix input Dur =(
31, 1, 4, 14, 18, 4, 32, 10, 3, 13, 14, 4, 3, 1, 3, 4, 4, 4, 4, 5, \
2, 21, 4, 4, 2, 2, 18, 8, 4, 5, 1, 7, 16, 2, 4, 7, 4, 7, 16, 1, \
2, 6, 4, 1, 7, 6, 7, 6, 16, 1, 10, 8, 9, 1, 9, 6, 1, 3, 3, 7, \
3, 1, 2, 1, 6, 1, 3, 5, 7, 8, 11, 4, 6, 3, 3, 11, 2, 2, 12, 7, \
4, 2, 2, 1, 8, 1, 15, 3, 1, 3, 2, 5, 2, 3, 5, 1, 5, 5, 4, 7, \
2, 3, 4, 2, 4, 2, 14, 3, 7, 1, 1, 7, 4, 8, 4, 4, 4, 1, 2, 2, \
3, 1, 1, 2, 2, 6, 1, 2, 2, 10, 1, 3, 3, 8, 19, 4, 3, 3, 4, 9, \
1, 1, 3, 7, 4, 5, 2, 9, 1, 5, 5, 1, 2, 2, 11, 1, 3, 6, 10, 5, \
4, 1, 1, 4, 2, 7, 2, 8, 2, 2, 2, 6, 1, 2, 4, 8, 2, 6, 1, 2, \
2, 4, 4, 3, 1, 4, 3, 1, 1, 1, 1, 1, 3, 6, 1, 2, 8, 3, 2, 1, \
1, 3, 8, 1, 1, 4, ., 1, 2, 2, 2, 1, 3, 6, 2, 1, 3, 8, 3, 2, \
2, 5, 5, 1, 6, 4, ., 1, 2, 1, 2, 3, 1, 6, 4, 3, 2, 3, 1, 2, \
4, 1, 1, 4, 1, 4, ., 2, 4, 1, 5, 3, 3, 6, 1, 5, 1, 3, 1, 1, \
1, 4, 2, 7, 1, 4, ., 1, 4, 2, 3, 7, 4, 6, 3, 4, 1, 1, 1, 5, \
3, 4, 2, 6, 4, 4, ., 1, 1, 3, 2, 15, 4, 6, 2, 3, 4, 4, 7, 1, \
5, 1, 5, 6, 4, 4, ., 4, 2, 3, 2, 1, 4, 6, 3, 1, 5, 1, 1, 3, \
2, 3, 3, 2, 4, ., ., 4, 1, 2, 4, 1, ., 6, 1, 1, 4, 2, 3, 5, \
1, 2, 2, 1, 1, ., ., 4, 1, 3, 2, 1, ., 6, 2, 3, 22, 4, 1, 2, \
1, 1, 2, 2, 3, ., ., 1, 1, 3, 2, 2, ., 1, 5, 1, 3, 1, 4, 5, \
2, 2, 1, 2, 2, ., ., 3, 1, ., 4, 1, ., 5, 1, 5, 1, 5, 5, 2, \
5, 2, 5, 4, 2, ., ., 3, 1, ., 1, 2, ., ., ., 1, 5, 5, 5, 1, \
1, 3, 2, 1, 4, ., ., 1, 1, ., 2, 1, ., ., ., 3, 1, 2, ., 2, \
1, 4, 1, 2, 1, ., ., 4, 2, ., 6, 1, ., ., ., 1, ., 3, ., 5, \
2, 1, 2, 3, 3, ., ., 4, 2, ., 2, 1, ., ., ., 1, ., 1, ., 5, \
4, 1, 6, 1, 4, ., ., 2, 1, ., 1, 4, ., ., ., 1, ., 1, ., 1, \
3, 2, 3, 1, 1, ., ., 2, 4, ., 1, ., ., ., ., 4, ., 1, ., 3, \
2, 3, 1, 4, ., ., ., ., 3, ., 3, ., ., ., ., 1, ., 1, ., 1, \
5, 4, 3, 3, ., ., ., ., 2, ., 3, ., ., ., ., 3, ., 1, ., 6, \
., 3, 2, 1, ., ., ., ., 3, ., ., ., ., ., ., 2, ., 5, ., 1, \
., 1, 5, 1, ., ., ., ., 3, ., ., ., ., ., ., 5, ., ., ., ., \
., 3, ., ., ., ., ., ., 1, ., ., ., ., ., ., ., ., ., ., ., \
., 1, ., ., ., ., ., ., 4, ., ., ., ., ., ., ., ., ., ., ., \
., ., ., ., ., ., ., ., 4, ., ., ., ., ., ., ., ., ., ., ., \
., ., ., ., ., ., ., ., 1, ., ., ., ., ., ., ., ., ., ., ., \
., ., ., ., ., ., ., ., 1, ., ., ., ., ., ., ., ., ., ., ., \
., ., ., ., ., ., ., ., 1, ., ., ., ., ., ., ., ., ., ., ., \
., ., ., ., ., ., ., ., 1, ., ., ., ., ., ., ., ., ., ., .);
#delimit cr
matrix define A = I(110)
matrix define NRegRand = I(20)
matrix define DurRand = A[1..110,1..20]
matrix define temp = A[1..110,1..20]
matrix define temp2 = A[1..110,1..20]
forvalues n = 1(1)20 {
local sum = 0
local r = 0
while `sum' < 100 {
local r = `r'+1
local loc = NReg[ 1, `n' ]
local duration = Dur[round(uniform() * ( `loc'- .0001) + .5), `n']
*Este local crea la matriz original (en lugar de la aleatoria).
*HAY QUE PONERLE UN ASTERISCO AL SIGUIENTE "if `sum' == 0" para que funcione.
*local duration = Dur[ `r' , `n']
if `sum' == 0 local duration = round(uniform()*(`duration'-.0001) + .5)
local sum = `sum' + `duration'
if `sum' >= 100 local duration = `duration' - `sum' + 100
if `sum' >= 100 matrix NRegRand[1, `n'] = `r'
matrix DurRand[`r',`n'] = `duration'
}
}
forvalues n = 1(1)20 {
scalar y = 0
scalar DURR = DurRand[1, `n']
local r = 1
scalar rr = 1
scalar list
while DURR > 0 {
scalar t = 0
while t <= DURR {
scalar t = t+1
matrix temp[ y + t, `n'] = `r'
matrix define temp2[ y + t, `n'] = y +1
}
scalar y = y + DURR
local r = `r'+1
scalar rr = `r'
scalar DURR = DurRand[`r', `n']
scalar list
}
}
svmat temp, names(ColReg`n')
svmat temp2, names(t0`n')
drop if _n>100
gen y = _n + 1900
tsset y
*Crea las dummies
forvalues i = 1(1)20{
forvalues r = 1(1)40{
gen P`i'G`r' = 0
replace P`i'G`r' = 1 if (_n == t0`i')&(ColReg`i' == `r')
replace P`i'G`r' = 1 if L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.t0`i' != t0`i'& ColReg`i' != `r'
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if L.P`i'G`r' == 0 & L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.L.P`i'G`r' == 1
replace P`i'G`r' = 0 if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en t=_n
drop y
save "$dir\100 (simul`s').dta", replace
*Saveold es por si lo hago en Stata10 y quiero que Stata9 pueda leerlo.
*saveold "$dir\100 (simul`s').dta", replace
}
***3***
*Capítulo 3, La Mamá de las Regresiones
clear
gen a=1
save $dir\MDLR, replace
clear
*Regresiones con datos reales.
use "$dir\100 (datos&dummies).dta", clear
forvalues p = 1(1)20 {
gen P`p' = 0
replace P`p'=1 if `p' == numpais
}
forvalues p = 1(1)20 {
gen P`p't = P`p'*t
}
drop if year<=1945
drop if year==1946
drop if year==1947
drop if year==1948
drop if year==1949
drop if year==1950
log using $dir\21Regresiones, text replace
reg y $P1G P1t if numpais==1
gen FP1Orig=e(F)
reg y $P2G P2t if numpais==2
gen FP2Orig=e(F)
reg y $P3G P3t if numpais==3
gen FP3Orig=e(F)
reg y $P4G P4t if numpais==4
gen FP4Orig=e(F)
reg y $P5G P5t if numpais==5
gen FP5Orig=e(F)
reg y $P6G P6t if numpais==6
gen FP6Orig=e(F)
reg y $P7G P7t if numpais==7
gen FP7Orig=e(F)
reg y $P8G P8t if numpais==8
gen FP8Orig=e(F)
reg y $P9G P9t if numpais==9
gen FP9Orig=e(F)
reg y $P10G P10t if numpais==10
gen FP10Orig=e(F)
reg y $P11G P11t if numpais==11
gen FP11Orig=e(F)
reg y $P12G P12t if numpais==12
gen FP12Orig=e(F)
reg y $P13G P13t if numpais==13
gen FP13Orig=e(F)
reg y $P14G P14t if numpais==14
gen FP14Orig=e(F)
reg y $P15G P15t if numpais==15
gen FP15Orig=e(F)
reg y $P16G P16t if numpais==16
gen FP16Orig=e(F)
reg y $P17G P17t if numpais==17
gen FP17Orig=e(F)
reg y $P18G P18t if numpais==18
gen FP18Orig=e(F)
reg y $P19G P19t if numpais==19
gen FP19Orig=e(F)
reg y $P20G P20t if numpais==20
gen FP20Orig=e(F)
reg y $Pt $P1G $P2G $P3G $P4G $P5G $P6G $P7G $P8G $P9G $P10G $P11G$P12G $P13G $P14G $P15G $P16G $P17G $P18G $P19G $P20G
gen FTOrig=e(F)
log close
keep F*
drop if _n>1
merge using $dir\MDLR
drop _merge
drop a
save $dir\MDLR, replace
*Regresiones con datos reales y CINCO LAGS.
use "$dir\100 (datos&dummies).dta", clear
forvalues p = 1(1)20 {
gen P`p' = 0
replace P`p'=1 if `p' == numpais
}
forvalues p = 1(1)20 {
gen P`p't = P`p'*t
}
drop if year<=1945
sort numpais year
gen x = L.L.L.L.L.y
drop y
ren x y
reg y $P1G P1t if numpais==1
gen FP1OrigLLLLL=e(F)
reg y $P2G P2t if numpais==2
gen FP2OrigLLLLL=e(F)
reg y $P3G P3t if numpais==3
gen FP3OrigLLLLL=e(F)
reg y $P4G P4t if numpais==4
gen FP4OrigLLLLL=e(F)
reg y $P5G P5t if numpais==5
gen FP5OrigLLLLL=e(F)
reg y $P6G P6t if numpais==6
gen FP6OrigLLLLL=e(F)
reg y $P7G P7t if numpais==7
gen FP7OrigLLLLL=e(F)
reg y $P8G P8t if numpais==8
gen FP8OrigLLLLL=e(F)
reg y $P9G P9t if numpais==9
gen FP9OrigLLLLL=e(F)
reg y $P10G P10t if numpais==10
gen FP10OrigLLLLL=e(F)
reg y $P11G P11t if numpais==11
gen FP11OrigLLLLL=e(F)
reg y $P12G P12t if numpais==12
gen FP12OrigLLLLL=e(F)
reg y $P13G P13t if numpais==13
gen FP13OrigLLLLL=e(F)
reg y $P14G P14t if numpais==14
gen FP14OrigLLLLL=e(F)
reg y $P15G P15t if numpais==15
gen FP15OrigLLLLL=e(F)
reg y $P16G P16t if numpais==16
gen FP16OrigLLLLL=e(F)
reg y $P17G P17t if numpais==17
gen FP17OrigLLLLL=e(F)
reg y $P18G P18t if numpais==18
gen FP18OrigLLLLL=e(F)
reg y $P19G P19t if numpais==19
gen FP19OrigLLLLL=e(F)
reg y $P20G P20t if numpais==20
gen FP20OrigLLLLL=e(F)
reg y $Pt $P1G $P2G $P3G $P4G $P5G $P6G $P7G $P8G $P9G $P10G $P11G$P12G $P13G $P14G $P15G $P16G $P17G $P18G $P19G $P20G
gen FTOrigLLLLL=e(F)
keep F*
drop if _n>1
merge using $dir\MDLR
drop _merge
save $dir\MDLR, replace
*Regresiones con datos reales y DOS LAGS.
use "$dir\100 (datos&dummies).dta", clear
forvalues p = 1(1)20 {
gen P`p' = 0
replace P`p'=1 if `p' == numpais
}
forvalues p = 1(1)20 {
gen P`p't = P`p'*t
}
drop if year<1945
drop if year==1946
drop if year==1947
drop if year==1948
sort numpais year
gen x = L.L.y
drop y
ren x y
reg y $P1G P1t if numpais==1
gen FP1OrigLL=e(F)
reg y $P2G P2t if numpais==2
gen FP2OrigLL=e(F)
reg y $P3G P3t if numpais==3
gen FP3OrigLL=e(F)
reg y $P4G P4t if numpais==4
gen FP4OrigLL=e(F)
reg y $P5G P5t if numpais==5
gen FP5OrigLL=e(F)
reg y $P6G P6t if numpais==6
gen FP6OrigLL=e(F)
reg y $P7G P7t if numpais==7
gen FP7OrigLL=e(F)
reg y $P8G P8t if numpais==8
gen FP8OrigLL=e(F)
reg y $P9G P9t if numpais==9
gen FP9OrigLL=e(F)
reg y $P10G P10t if numpais==10
gen FP10OrigLL=e(F)
reg y $P11G P11t if numpais==11
gen FP11OrigLL=e(F)
reg y $P12G P12t if numpais==12
gen FP12OrigLL=e(F)
reg y $P13G P13t if numpais==13
gen FP13OrigLL=e(F)
reg y $P14G P14t if numpais==14
gen FP14OrigLL=e(F)
reg y $P15G P15t if numpais==15
gen FP15OrigLL=e(F)
reg y $P16G P16t if numpais==16
gen FP16OrigLL=e(F)
reg y $P17G P17t if numpais==17
gen FP17OrigLL=e(F)
reg y $P18G P18t if numpais==18
gen FP18OrigLL=e(F)
reg y $P19G P19t if numpais==19
gen FP19OrigLL=e(F)
reg y $P20G P20t if numpais==20
gen FP20OrigLL=e(F)
reg y $Pt $P1G $P2G $P3G $P4G $P5G $P6G $P7G $P8G $P9G $P10G $P11G$P12G $P13G $P14G $P15G $P16G $P17G $P18G $P19G $P20G
gen FTOrigLL=e(F)
keep F*
drop if _n>1
merge using $dir\MDLR
drop _merge
save $dir\MDLR, replace
*Regresiones con datos reales y DOS FORWARDS.
use "$dir\100 (datos&dummies).dta", clear
forvalues p = 1(1)20 {
gen P`p' = 0
replace P`p'=1 if `p' == numpais
}
forvalues p = 1(1)20 {
gen P`p't = P`p'*t
}
drop if year<=1945
drop if year==1946
drop if year==1947
drop if year==1948
sort numpais year
gen x = F.F.y
drop y
ren x y
reg y $P1G P1t if numpais==1
gen FP1OrigFF=e(F)
reg y $P2G P2t if numpais==2
gen FP2OrigFF=e(F)
reg y $P3G P3t if numpais==3
gen FP3OrigFF=e(F)
reg y $P4G P4t if numpais==4
gen FP4OrigFF=e(F)
reg y $P5G P5t if numpais==5
gen FP5OrigFF=e(F)
reg y $P6G P6t if numpais==6
gen FP6OrigFF=e(F)
reg y $P7G P7t if numpais==7
gen FP7OrigFF=e(F)
reg y $P8G P8t if numpais==8
gen FP8OrigFF=e(F)
reg y $P9G P9t if numpais==9
gen FP9OrigFF=e(F)
reg y $P10G P10t if numpais==10
gen FP10OrigFF=e(F)
reg y $P11G P11t if numpais==11
gen FP11OrigFF=e(F)
reg y $P12G P12t if numpais==12
gen FP12OrigFF=e(F)
reg y $P13G P13t if numpais==13
gen FP13OrigFF=e(F)
reg y $P14G P14t if numpais==14
gen FP14OrigFF=e(F)
reg y $P15G P15t if numpais==15
gen FP15OrigFF=e(F)
reg y $P16G P16t if numpais==16
gen FP16OrigFF=e(F)
reg y $P17G P17t if numpais==17
gen FP17OrigFF=e(F)
reg y $P18G P18t if numpais==18
gen FP18OrigFF=e(F)
reg y $P19G P19t if numpais==19
gen FP19OrigFF=e(F)
reg y $P20G P20t if numpais==20
gen FP20OrigFF=e(F)
reg y $Pt $P1G $P2G $P3G $P4G $P5G $P6G $P7G $P8G $P9G $P10G $P11G$P12G $P13G $P14G $P15G $P16G $P17G $P18G $P19G $P20G
gen FTOrigFF=e(F)
keep F*
drop if _n>1
merge using $dir\MDLR
drop _merge
save $dir\MDLR, replace
*Regresiones con datos reales y CINCO FORWARDS.
use "$dir\100 (datos&dummies).dta", clear
forvalues p = 1(1)20 {
gen P`p' = 0
replace P`p'=1 if `p' == numpais
}
forvalues p = 1(1)20 {
gen P`p't = P`p'*t
}
drop if year<=1945
sort numpais year
gen x = F.F.F.F.F.y
drop y
ren x y
reg y $P1G P1t if numpais==1
gen FP1OrigFFFFF=e(F)
reg y $P2G P2t if numpais==2
gen FP2OrigFFFFF=e(F)
reg y $P3G P3t if numpais==3
gen FP3OrigFFFFF=e(F)
reg y $P4G P4t if numpais==4
gen FP4OrigFFFFF=e(F)
reg y $P5G P5t if numpais==5
gen FP5OrigFFFFF=e(F)
reg y $P6G P6t if numpais==6
gen FP6OrigFFFFF=e(F)
reg y $P7G P7t if numpais==7
gen FP7OrigFFFFF=e(F)
reg y $P8G P8t if numpais==8
gen FP8OrigFFFFF=e(F)
reg y $P9G P9t if numpais==9
gen FP9OrigFFFFF=e(F)
reg y $P10G P10t if numpais==10
gen FP10OrigFFFFF=e(F)
reg y $P11G P11t if numpais==11
gen FP11OrigFFFFF=e(F)
reg y $P12G P12t if numpais==12
gen FP12OrigFFFFF=e(F)
reg y $P13G P13t if numpais==13
gen FP13OrigFFFFF=e(F)
reg y $P14G P14t if numpais==14
gen FP14OrigFFFFF=e(F)
reg y $P15G P15t if numpais==15
gen FP15OrigFFFFF=e(F)
reg y $P16G P16t if numpais==16
gen FP16OrigFFFFF=e(F)
reg y $P17G P17t if numpais==17
gen FP17OrigFFFFF=e(F)
reg y $P18G P18t if numpais==18
gen FP18OrigFFFFF=e(F)
reg y $P19G P19t if numpais==19
gen FP19OrigFFFFF=e(F)
reg y $P20G P20t if numpais==20
gen FP20OrigFFFFF=e(F)
reg y $Pt $P1G $P2G $P3G $P4G $P5G $P6G $P7G $P8G $P9G $P10G $P11G$P12G $P13G $P14G $P15G $P16G $P17G $P18G $P19G $P20G
gen FTOrigFFFFF=e(F)
keep F*
drop if _n>1
merge using $dir\MDLR
drop _merge
save $dir\MDLR, replace
*Regresiones con simulaciones.
forvalues s = 1(1)1000{
use "$dir\100 (simul`s').dta", clear
sort t
merge t using "$dir\100 (datos).dta"
drop _*
*Los países están todos completos sólo a partir de 1946.
*Entre dropear a los países problemáticos (estos países son los que tenían mejor F simulada que la real) y dropear los años problemáticos, preferí lo segundo.
drop if year<=1945
*Dummies de país interactuadas por tiempo
forvalues p = 1(1)20 {
gen P`p' = 0
replace P`p'=1 if `p' == numpais
}
forvalues p = 1(1)20 {
gen P`p't = P`p'*t
}
*Ceros en las dummies de los países donde no debe ir dummy.
forvalues p = 1(1)20 {
forvalues g = 1(1)40 {
replace P`p'G`g' = P`p'G`g'*P`p'
}
}
*Las siguientes las borro para que cuando haga regresiones con, digamos, L.L.L.L.L.y $P1G P1t, todas las F vengan de regresiones del mismo tamaño (n=95).
drop if year==1946
drop if year==1947
drop if year==1948
drop if year==1949
drop if year==1950
reg y $P1G P1t if numpais==1
gen FP1S`s'=e(F)
reg y $P2G P2t if numpais==2
gen FP2S`s'=e(F)
reg y $P3G P3t if numpais==3
gen FP3S`s'=e(F)
reg y $P4G P4t if numpais==4
gen FP4S`s'=e(F)
reg y $P5G P5t if numpais==5
gen FP5S`s'=e(F)
reg y $P6G P6t if numpais==6
gen FP6S`s'=e(F)
reg y $P7G P7t if numpais==7
gen FP7S`s'=e(F)
reg y $P8G P8t if numpais==8
gen FP8S`s'=e(F)
reg y $P9G P9t if numpais==9
gen FP9S`s'=e(F)
reg y $P10G P10t if numpais==10
gen FP10S`s'=e(F)
reg y $P11G P11t if numpais==11
gen FP11S`s'=e(F)
reg y $P12G P12t if numpais==12
gen FP12S`s'=e(F)
reg y $P13G P13t if numpais==13
gen FP13S`s'=e(F)
reg y $P14G P14t if numpais==14
gen FP14S`s'=e(F)
reg y $P15G P15t if numpais==15
gen FP15S`s'=e(F)
reg y $P16G P16t if numpais==16
gen FP16S`s'=e(F)
reg y $P17G P17t if numpais==17
gen FP17S`s'=e(F)
reg y $P18G P18t if numpais==18
gen FP18S`s'=e(F)
reg y $P19G P19t if numpais==19
gen FP19S`s'=e(F)
reg y $P20G P20t if numpais==20
gen FP20S`s'=e(F)
reg y $Pt $P1G $P2G $P3G $P4G $P5G $P6G $P7G $P8G $P9G $P10G$P11G $P12G $P13G $P14G $P15G $P16G $P17G $P18G $P19G $P20G
gen FTS`s'=e(F)
keep F*
drop if _n>1
merge using $dir\MDLR
drop _merge
save $dir\MDLR, replace
}
*Stata 10 parece dropear variables aleatoriamente. Los siguientes comandos revisan que todo esté bien.
*Debe generar a=1000 (ó a=s).
des
gen a=r(k)/21 - 5
merge using $dir\MDLR
drop _merge
save $dir\MDLR, replace
*Calcular varianza de Dy por país y ver si se correlacionan con las F altas.
*Igual con Dy de tamaño más grande (gen Dy = L.L.L.L.L.y - y).
*HAY QUE TENER CUIDADO CON EL HECHO DE QUE, EN LOS MERGES, STATA SALVA LOS PAÍSES DEL 20 AL 1.
forvalues p = 1(1)20 {
use "$dir\100 (datos&dummies).dta", clear
drop if year<1945
drop if numpais != `p'
sort numpais year
gen DLLLLLy = y - L.L.L.L.L.L.y
collapse (sd) DLLLLLy
ren DLLLLLy stdDLLLLLyP`p'
drop if _n>1
merge using $dir\MDLR
drop _merge
save $dir\MDLR, replace
}
forvalues p = 1(1)20 {
use "$dir\100 (datos&dummies).dta", clear
drop if year<1945
drop if numpais != `p'
sort numpais year
gen DLLy = y - L.L.L.y
collapse (sd) DLLy
ren DLLy stdDLLyP`p'
drop if _n>1
merge using $dir\MDLR
drop _merge
save $dir\MDLR, replace
}
forvalues p = 1(1)20 {
use "$dir\100 (datos&dummies).dta", clear
drop if year<1945
drop if numpais != `p'
sort numpais year
collapse (sd) Dy
ren Dy stdDyP`p'
drop if _n>1
merge using $dir\MDLR
drop _merge
save $dir\MDLR, replace
}
*Salva todo en formato bonito para Excel.
forvalues p = 1(1)20 {
use $dir\MDLR, clear
keep FP`p'S*
outsheet using $tempdir\FP`p'S, replace
}
use $dir\MDLR, clear
keep FT*
outsheet using $tempdir\FT, replace
use $dir\MDLR, clear
keep FP??Orig FP?Orig FTOrig
outsheet using $tempdir\FOrig, replace
use $dir\MDLR, clear
keep FP??OrigLL FP?OrigLL FTOrigLL
outsheet using $tempdir\FOrigLL, replace
use $dir\MDLR, clear
keep FP??OrigLLLLL FP?OrigLLLLL FTOrigLLLLL
outsheet using $tempdir\FOrigLLLLL, replace
use $dir\MDLR, clear
keep FP??OrigFFFFF FP?OrigFFFFF FTOrigFFFFF
outsheet using $tempdir\FOrigFFFFF, replace
use $dir\MDLR, clear
keep FP??OrigFF FP?OrigFF FTOrigFF
outsheet using $tempdir\FOrigFF, replace
use $dir\MDLR, clear
keep stdDyP? stdDyP??
outsheet using $tempdir\stdD, replace
use $dir\MDLR, clear
keep stdDLLyP? stdDLLyP??
outsheet using $tempdir\stdDLLy, replace
use $dir\MDLR, clear
keep stdDLLLLLyP? stdDLLLLLyP??
outsheet using $tempdir\stdDLLLLLy, replace
*Para verificar que todo esté bien (sólo debe quedar una variable con una
*observación a = 1000):
use $dir\MDLR, clear
drop FP?S* FP??S* FT* FP??Orig FP?Orig FTOrig FP??OrigLL FP?OrigLL FTOrigLL FP??OrigLLLLL FP?OrigLLLLL FTOrigLLLLL FP??OrigFFFFF FP?OrigFFFFF FTOrigFFFFF FP??OrigFF FP?OrigFF FTOrigFF stdDyP? stdDyP?? stdDLLyP? stdDLLyP?? stdDLLLLLyP? stdDLLLLLyP??
*PARA CALCULAR LA CORRELACIÓN ENTRE CRECIMIENTO E INESTABILIDAD ESTÁ LA SIGUIENTE RUTINA.
*Lo que sale en el edit se pega transpuesto en Excel y se saca la correlación con el número de gobiernos de cada país (los componentes de NReg):
*NReg=(28, 32, 30, 30, 26, 16, 10, 26, 37, 19, 28, 25, 16, 20, 20, 30, 22, 29, 21, 29);
*use "$dir\OxfordLatAm.dta", clear
*keep numpais year gdp1970
*gen t = 1 if year==1951
*replace t=2 if year==2000
*drop if t==.
*tsset numpais t
*gen crecimiento = (gdp1970 - L.gdp1970)/L.gdp1970
*drop if crecimiento == .
*edit numpais crecimiento
*INSTRUCCIONES PARA PROSEGUIR:
*Supongamos que el directorio ($tempdir) donde se salvaron los archivos anteriores es c:\temp\temp.
*Recordemos que se pueden pegar comandos en la ventana de DOS haciendo right-click.
*Presionar win-r, escribir cmd, presionar ENTER.
*En DOS, escribir: cd c:\temp\temp
*Escribir: type * >> c:\TODO.out
*Lo anterior pega los 29 archivos. Abrir el archivo c:\TODO.out con Excel.
*Copiar esa página y pegarla TRANSPUESTA en la hoja ENTRADA del archivo Pruebas.xls (la última celda es la ALQ58).
*Revisar los resultados de la hoja RESULTADOS.