marginal optimization in R_SetupFrame()