Analisis Portofolio Tingkat Menengah di R
Ross Bennett
Instructor
Banyak solver tidak khusus untuk optimisasi portofolio
Pahami kemampuan dan batas solver untuk memilih solver yang tepat atau memformulasi ulang masalah agar sesuai
Sulit beralih antar-solver
Solver bentuk tertutup (mis. pemrograman kuadratik)
Solver global (mis. optimisasi evolusi diferensial)
$$\omega_{i} >= 0$$
$$\sum_{i=1}^{n} \omega_i = 1$$
Gunakan paket R quadprog untuk menyelesaikan optimisasi utilitas kuadratik
solve.QP() menyelesaikan pemrograman kuadratik dengan bentuk:
$$min(-d^Tb+\frac{1}{2}b^TDb)$$
$$A^Tb>=b_0$$
library(quadprog)
data(edhec)
dat <- edhec[,1:4]
# Create the constraint matrix
Amat <- cbind(1, diag(ncol(dat)), -diag(ncol(dat)))
# Create the constraint vector
bvec <- c(1, rep(0, ncol(dat)), -rep(1, ncol(dat)))
# Create the objective matrix
Dmat <- 10 * cov(dat)
# Create the objective vector
dvec <- colMeans(dat)
# Specify number of equality constraints
meq <- 1
# Solve the optimization problem
opt <- solve.QP(Dmat, dvec, Amat, bvec, meq)
Analisis Portofolio Tingkat Menengah di R