R code: 蒙地卡羅模擬 20211126

m01 <- matrix( rnorm(30*100000, 1.07, 0.2), ncol = 30 )
df1 <- matrix(4200,nrow=100000,ncol = 1)
for(i in 1:100000)
{
k <- df1[i]
ref <- m01[i,]
for(j in 1:30)
{
k <- k*ref[j]-60*1.02^(j-1)-106
}
df1[i] <-k
}
quantile(df1, c(.25,.26,.27))

留言

這個網誌中的熱門文章

槓桿ETF的蒙地卡羅模擬 (Leveraged ETF Monte Carlo)

Lifecycle investing-2-貸款的方式 (leverage choices)