#variancna funkcia varfun <- function(F, w, crit="D") { n <- nrow(F) m <- ncol(F) supp <- w > 0; w.supp <- w[supp]; F.supp <- F[supp,] M <- crossprod(sqrt(w.supp) * F.supp) if(crit=="D") { var.fun <- ((F %*% t(chol(solve(M))))^2) %*% rep(1, m) } else { var.fun <- ((F %*% solve(M))^2) %*% rep(1, m) } return(as.vector(var.fun)) } Fq <- F.cube(~x1+I(x1^2), -1, 1, 101) qD <- od.AA(Fq) qA <- od.AA(Fq, crit="A") plot(Fq[,2], varfun(Fq, qD$w.best), type="l", lwd=2, col="red", ylim=c(1.5,3)) lines(Fq[,2], varfun(Fq, qA$w.best), col="blue", lwd=2) plot(Fq[,2], varfun(Fq, qA$w.best, crit="A"), type="l", lwd=2, col="red", ylim=c(2,20)) lines(Fq[,2], varfun(Fq, qD$w.best, crit="A"), col="blue", lwd=2) # Trigonometricky model na ciastocnom kruhu F.trig <- F.cube(~I(cos(x1)) + I(sin(x1)) + I(cos(2 * x1)) + I(sin(2 * x1)) + I(cos(3 * x1)) + I(sin(3 * x1)), -pi/2, pi/2, 200) tD <- od.AA(F.trig, 1, alg = "doom", crit = "D", graph=1:7, t.max=4) tA <- od.AA(F.trig, 1, alg = "doom", crit = "A", graph=1:7, t.max=4) # efektivita exaktnych navrhov F2 <- F.cube(~x1+x2+I(x1^2)+I(x2^2)+I(x1*x2), c(-1,-1), c(1,1), c(9,9)) app <- od.AA(F2) ex <- rep(0, 15) eff <- rep(0, 15) for (i in 6:20){ ex[i-5] <- od.KL(F2, i, t.max=3)$Phi.best eff[i-5] <- ex[i-5]/ od.crit(F2, i*app$w.best) } plot(6:20, eff, type="b", lwd=2, col="red") # modely zmesi a pouzitie F.simplex Fm <- F.simplex(~x1 + x2 + x3 + I(x1 * x2) + I(x1 * x3) + I(x2 * x3) - 1, 3, 51)