This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
######################### | |
# | |
# | |
# Model of a Private Firm | |
# | |
# | |
######################### | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type ModelBase | |
beta::Float64 # Firm discount | |
rBorrow::Float64 # Bank-Govt discount | |
delta::Float64 # Depreciation Rate | |
theta::Float64 # Leverage Ratio | |
sigmaZ::Float64 # Std Dev of shock | |
rho::Float64 # Persistance of shock | |
nK::Int64 | |
nQ::Int64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// | |
// | |
// C functions for heavy duty | |
// | |
// gcc -shared -fPIC -O3 optimize.c -lgsl -lm -lgslcblas -o findP.so | |
// icc -fast -I/home/gcam/china/gsl -L/home/gcam/china/gsl/.libs -shared -fPIC optimize.c -lgsl -lgslcblas -o findP.so | |
// gcc -I/home/gcam/china/gsl -L/home/gcam/china/gsl/.libs -shared -fPIC optimize.c -lgsl -o findP.so | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
annual_data <- data.table(year=1991:2000,ret=rnorm(200),group=1:20) | |
yearly_deciles <- annual_data[,data.table(t(quantile(ret,probs=seq(from=.1, to = 1, length.out=10)))),by=year] | |
find_decile <- function(thisReturn,year,decile_table){ | |
for(i in 2:ncol(decile_table)){ | |
if(thisReturn<decile_table[year==year,i,with=F]) | |
return(i-1) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN MESSAGE. | |
S5PUBxbi0MPhBKX zx4vkVoJfF8DSEB 61cw6KrETyf6aCm tmHIHAOswmWbHEC | |
tlpRXHPCgCddxN4 erzPpnuG1WeTCKq 6Xr2MZHgg6lVPDg rVQindRVNk6gCMO | |
lmocZ0zx6Nl9TJA PJLlwJEkRwRkhVT 3PN39qhgXFmEG3K JZDaaS6Cr69uyZb | |
gDO4hBjFppDiPQO Pmc6n7c3k46OJsd 9ddYI2IP. | |
END MESSAGE. |