powered by
Pipeline per iteration:
Simulate \(n\) paths under the chosen model (BS/Heston-family).
Compute continuation scores \(a_{i,j}\) via function_AMS_Cpp.
function_AMS_Cpp
Set level \(L =\) K-th order statistic of \(\max_j a_{i,j}\).
Identify survivors (top \(n-K\)) and parents (\(K\) indices that cleared the level).
For each parent, cut at first index that exceeds \(L\) and resimulate the suffix.
Repeat until \(L \ge L_{\max}\). Then compute discounted payoff on the final population.
AMS( model, type, funz, n, t, p, r, sigma, S0, rho = NULL, rim = 0L, v0 = 0.04, Lmax = 0, strike = 1, K = 1L )
List with price and std.
price
std
1 = Black–Scholes; 2,3,4 = Heston variants (as in simulate_AMS).
simulate_AMS
Payoff type passed to payoff() and function_AMS_Cpp (1..6).
payoff()
1 = BS digital proxy in continuation; 2 = raw feature (signed).
Population size (> K).
Maturity in years (>0).
Total time steps (>0).
Risk–free rate.
BS volatility (used by continuation; >0 if funz == 1).
funz == 1
Initial spot.
Correlation for Heston models (required for model >= 2, in \([-1,1]\)).
model >= 2
Left-trim for simulation (keep last p - rim steps; 0 <= rim < p).
p - rim
0 <= rim < p
Initial variance for Heston models (>=0).
Stopping level: iterate while \(L < L_{\max}\).
Strike \(K\) used by continuation and final payoff.
Number of resampled offspring per iteration (1..n-1).
# \donttest{ out <- AMS(model = 2, type = 3, funz = 1, n = 500, t = 1, p = 252, r = 0.03, sigma = 0.2, rho = -0.5, S0 = 1, rim = 0, Lmax = 0.5, strike = 1.3, K = 200) str(out) # }
Run the code above in your browser using DataLab