# Some environment vector
vec_env <- seq(-2, 2)
# Shape function
expr <- expression(
cmax * exp(
- exp(rho * (x - xopt) - 6) -
sigmagaus * (x - xopt)^2
))
# Theta
theta <- c(cmax = 1, xopt = 0.9, rho = 8, sigmagaus = 0.4)
# G, only for cmax and xopt
G <- matrix(c(0.1, 0.01,
0.01, 0.05),
ncol = 2)
# Another covariance matrix for cmax and xopt (e.g. permanent environment, or maternal effet)
M <- matrix(c(0.05, 0,
0, 0.01),
ncol = 2)
# Full variance-covariance matrix
P <- G + M
# Residual variance
vr <- 0.1
# Computing V_tot
rn_vp_env(theta = theta,
V_theta = P,
var_res = vr,
env = vec_env,
shape = expr,
fixed = c(3, 4))
# Note that fixed is set for the third and forth parameters than are not in P
Run the code above in your browser using DataLab