function() { #Program input.routine.1() # #Does all preparation required prior to running the project() program. Can #be revised to implement different assumptions. This routine (".1") generally #keeps things as simple as possible, assuming most forces and parameters #constant over time. # # #argument parameter stuff # # # #initialize arrays, specifying dimensions (all must be >= 2) # initialize(aa = 60, dd = 20, tt = 50) # # # #forces of mortality from non-HIV-related causes # mu.female <- compute.mu(-0.15, 1) # #lists containing mu and mu.male <- compute.mu(-0.05, 1) # # # mu.b for single year mu.f <<- array(data = mu.female$mu, dim = dim(mu.f)) #for female initial pop mu.m <<- array(data = mu.male$mu, dim = dim(mu.f)) # #for male initial pop mu.fb <- rep(mu.female$mu.b, times = tt) # #for female births during period mu.mb <- rep(mu.male$mu.b, times = tt) # # #for male births during period names(mu.fb) <- names(mu.mb) <- 0:(tt - 1) # #assign names mu.fb <<- mu.fb # #write global variable mu.mb <<- mu.mb # #write global variable # # #force of becoming sexually active (male paramter values are for equal area under curve) # upsilon.f <<- array(data = compute.upsilon(v.scale = 0.006053, gamma = 6.46732, peak = 9), dim = dim(upsilon.f) ) # upsilon.m <<- array(data = compute.upsilon(v.scale = 0.000223, gamma = 6.46732, peak = 10.5), dim = dim( upsilon.m)) # # # #force of becoming sexually inactive # tau.f <<- array(data = compute.tau(begin.age = 30, slope = 0.0004), dim = dim(tau.f)) # tau.m <<- array(data = compute.tau(begin.age = 40, slope = 0.0003), dim = dim(tau.f)) # # # #age pattern phi for iota, kappa and theta (force of new infection parameters) # phi.f <- compute.phi(v.scale = 0.00015173, gamma = 3.8724, peak = 13.669) # phi.m <- compute.phi(v.scale = 3.4485e-005, gamma = 3.8125, peak = 23.285) # # phi.f <<- phi.f # phi.m <<- phi.m # # # # #iota, kappa and theta # iota.f <<- array(data = 0.004 * phi.f, dim = dim(iota.f)) # iota.m <<- array(data = 0.004 * phi.m, dim = dim(iota.m)) # # kappa.f <<- 0.1 * phi.f # kappa.m <<- 0.1 * phi.m # # level.f <- compute.theta.time.trend(initial.level = 0.3, start.change = 10, stop.change = 20) # level.m <- compute.theta.time.trend(initial.level = 0.3, start.change = 10, stop.change = 20) # # theta.f <<- phi.f %o% level.f # theta.m <<- phi.m %o% level.m # # # #forces of mortality from HIV-related causes # alpha <<- array(data = get.alpha()[1:aa, 1:dd], dim = dim(alpha)) # # # #fertility rates and sex ratio at birth # beta.y <<- array(data = compute.beta(), dim = dim(beta.y)) # beta.z <<- array(data = compute.beta(), dim = dim(beta.z)) # srb <- 1.05 # sigma.f <<- 1/(1 + srb) # sigma.m <<- srb/(1 + srb) # # # #compute initial population distribution # growth.rate <- 0.03 stable.ad.f <- compute.stable.ad(r = growth.rate, mu = mu.f[, 1]) # stable.ad.m <- compute.stable.ad(r = growth.rate, mu = mu.m[, 1]) # # p.active.f <- compute.proportions.active(mu.f[, 1], upsilon.f[, 1], tau.f[, 1]) # p.active.m <- compute.proportions.active(mu.m[, 1], upsilon.m[, 1], tau.m[, 1]) # # # xf1 <- stable.ad.f * (1 - p.active.f) # yf1 <- stable.ad.f * p.active.f # xm1 <- stable.ad.m * (1 - p.active.m) # ym1 <- stable.ad.m * p.active.m # # factor <- 100000/sum(xf1 + yf1 + xm1 + ym1) # # xf[, 1] <<- xf1 * factor # yf[, 1] <<- yf1 * factor # xm[, 1] <<- xm1 * factor # ym[, 1] <<- ym1 * factor # # # #wrap up # write.ascii(input.routine.1) "All done" }