emir toktar emirtoktargmailcom dear marc id used acceptance sampling possible minimize given problem fits well calculate necessary acceptance plan defined assess probabilities p1p2 consumer producer risks thank tips etoktar original message marc schwartz mailtomarc_schwartzcomcastnet sent tuesday august 05 2008 112 pm spencer graves cc emirtoktargmailcom rhelprprojectorg subject r optimize simultaneously two binomials inequalities using nlm optim quick follow spencers post might want look acceptancesampling package cran httpcranrprojectorgwebpackagesacceptancesamplingindexhtml hth marc schwartz 08052008 0900 spencer graves wrote saw post 729 seen reply attempt response question start email obtain smallest value n sample size satisfying inequalities 1alpha pbinomc n p1 pbinomc n p2 beta alpha p1 p2 beta given assume c also given though thats perfectly clear since n integer standard optimizers like optim nlm really appropriate sounds like integer programming rsitesearchinteger programming fun produced 138 hits might find something useful however tried id try simpler things first consider example following c 5 used c c c name function r alpha 05 beta 8 p1 2 p2 9 n c20 p1 pbinomc n p1 p2 pbinomc n p2 good 1alpha p1 p2 beta minngood op parmfrowc2 1 plotn p1 ablineh1alpha plotn p2 ablinehbeta parop case n 6 satisfies inequalities though n 15 minngood inf either solution exists need increase upper bound search range n youd like help please read posting guide httpwwwrprojectorgpostingguidehtml provide commented minimal selfcontained reproducible code hope helps spencer graves emirtoktargmailcom wrote dear r users im trying optimize simultaneously two binomials inequalities used acceptance sampling nonlinear solution simple direct solution please let explain shortly problem question following objective obtain smallest value n sample size satisfying inequalities 1alpha pbinomc n p1 pbinomc n p2 beta p1 aql p2 ltpd probabilities parameters consumer producer alpha beta conumer producer risks finally n represents sample size c acceptance number maximum number defects nonconforming sample size considering n c values integer variables commonly possible derive oc curve including p11alpha p2beta points adjacency compromise commonly required achieved searching precise oc curve respect one points im using mathematica 6 trial would like use r intead better need exemplify mathematica call function using nminimize passing restriction parameters function name findopt parameters restriction 1 alpha cdfbinomialdistributionsample_n p1 c betha cdfbinomialdistributionsample_n p2 c 0 alpha alphamax 0 betha bethamax 1 sample_n lot_size 0 c lot_size p1 p2 p2max fcost sample_nlot_size result nminimizefcost restriction sample_n c alpha betha p2max method neldermead accuracygoal 10 calling function findopt findoptp10005 lot_size1000 alphamax005 bethamax 005 p2max 004 got return values minimal n c alpha betha p2 ltpd computed 0514573 alpha74 00218683 sample_n74 155231 betha74 005 c74 2 p274 004 using r would define pbinomc n prob given minimum maximum values n c limits p1 p2 probabilities consumer producer similar example found examples optimize equations r tips able define sintaxe use functions among functions could used resolve problem presented found function optim used unconstrained optimization nlm used solving nonlinear unconstrained minimization problems may wrong nlm function would appropriate solve problem right get pointer solve problem using nlm function could get tipsexample help please 1alpha pbinomc n p1 pbinomc n p2 beta used betha parameter name avoid beta function used mathematica finds functionp1numeric lot_sizenumeric alphamaxnumeric bethamax numeric p2max numeric 1 alpha pbinomc sample_n p1 betha pbinomc sample_n p2 0 alpha alphamax 0 betha bethamax 1 sample_n lot_size 0 c lot_size p1 p2 p2max parameters p10005 lot_size1000 alphamax005 bethamax 005 p2max 004 minimize results returnprinting following values sample_n minimal sample size c critical level defectives alpha producers risk betha consumers risk p2max consumers probability p2 could one help understand desing optimize nonlinear function using r two binomials point tips thanks advance etoktar ______________________________________________ rhelprprojectorg mailing list httpsstatethzchmailmanlistinforhelp please read posting guide httpwwwrprojectorgpostingguidehtml provide commented minimal selfcontained reproducible code wed 06 aug 2008 184554 0300 r optimize simultaneously two binomials inequalities using nlm optim