# NOT RUN {
<!-- % library(adoption); library(RandomFieldsUtils) -->
# }
# NOT RUN {
Goldenberg <- list( ## model by Goldenberg, Libai, Muller (2010)
m = 1000L,
repetitions=10L,
dt = 1,
relative.instance = 0.2,
SOCIAL = c(1, 5, 5),
PRIVATE = c(5, 1, 5),
Ic.start = function(param, m, rep, ...) {
m * rnorm(m * rep, param[1], prod(param[1:2]))
},
Ic = function(param, Nt, m, start) {
Inf * (2 * (Nt > start) - 1) ## start has size m * rep, i.e. Nt is
## recycled
},
Ic.param = c("mean h" = 0.02,
"sigma" = 0.4),
Ic.param.min = c(0.005, 0.08),
Ic.param.max = c(0.1, 1.5),
coord = function(param, m) {
if (param[1] == 1) as.matrix(1:m)
else {
m2 <- ceiling(sqrt(m))
m3 <- ceiling(m / m2)
as.matrix(expand.grid(1:m2, 1:m3))[1:m, ]
}},
coord.param = c(dim = 2),
weight = function(param, dist, W) {
GoldenbergDistance(param, dist, W, 1e6)
},
weight.param.min = 1.5,
weight.param.max = 1.5,
weight.param = c("max distance d"=1.5),
Utrafo = function(U, threshold, ...) 1e6 * as.double(U>=threshold),
Uthreshold = 0, ## here: constant for any people; we might
Uthreshold.min = 0,
Uthreshold.max = 0,
Up.start = function(param, m, rep) rep(-1, m * rep),
Up = function(param, m, nT, rep, ...) {
pmax(-1e6 + 1,
-log(runif(nT * rep * m)/(1-param[1])) / log(1-param[2]))
},
Up.param = c(prob_a=0.1, prob_b=0.1),
Up.param.min = c(0.005, 0.05),
Up.param.max = c(0.99, 0.99),
"MAX/PLUS OPERATORS" = rep(5, 3),
alpha = c("alpha_1"=0, "alpha_2"=1),
alpha.min = c(0, 1),
alpha.max = c(0, 1),
beta = c("beta_1"=1, "beta_2"=1),
beta.min = c(1, 1),
beta.max = c(1, 1),
gamma = c("gamma_1"=0.5, "gamma_2"=0.5),
gamma.min = c(0.5, 0.5),
gamma.max = c(0.5, 0.5)
)
RFoptions(cores=2) ## see package RandomFieldsUtils
print(adoption(Goldenberg, join_models=FALSE, buttons2right=TRUE,
gui=interactive()))
# }
Run the code above in your browser using DataLab