Re: [R] rsolnp- Error (Help!)
Since you only have box constraints, you do not need to use "rsolnp". You can use `nlminb' or optim's "L-BFGS-B" or `spg' in "BB". I ran your problem using these algorithms, and I was not sure that I was getting a local minimum. Check your functions carefully, it seems like you may have some mistakes. Y1 <- optim(par=p0, fn=opti, method="L-BFGS-B", lower=lCons, upper=uCons) Y2 <- nlminb(start=p0, obj=opti, lower=lCons, upper=uCons) Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: rvarad...@jhmi.edu Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty_personal_pages/Varadhan.html -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of tushar_kul Sent: Monday, September 28, 2009 4:52 PM To: r-help@r-project.org Subject: Re: [R] rsolnp- Error (Help!) Thanks, Ravi. I have attached the code again. (Still the same error) http://www.nabble.com/file/p25652730/OptTS.txt OptTS.txt Ravi Varadhan wrote: > > I was trying to run your code, but it seems like you haven’t specified the > parameter called `Strk', so I was unable to run it. Can you send a fully > reproducible code? > > jholtman wrote: >> >> It means that your expression "max(tt[2] - 10 * tol, nineq)" is returning >> NA: >> >> Notice I get the same error: >> >>> if (1==1)1 >> [1] 1 >>> if (NA == 1) 1 >> Error in if (NA == 1) 1 : missing value where TRUE/FALSE needed >> >> Check your script and see why it is NA. you might need: >> >> max(tt[2] - 10 * tol, nineq, na.rm=TRUE) >> >> If your data has NAs. >> >> On Sun, Sep 27, 2009 at 5:29 PM, tushar_kul wrote: >>> >>> Hi >>> >>> I am relatively new to R and was trying to run an optimization problem >>> using >>> rsolnp. I am getting an error which seems to be not related to my >>> construct >>> of the optimization equations. >>> >>> Error in if (max(tt[2] - 10 * tol, nineq) <= 0) rho = 0 : >>> missing value where TRUE/FALSE needed >>> >>> I have attached the file code. >>> >>> I would greatly appreciate any help. >>> >>> Many thanks >>> >>> http://www.nabble.com/file/p25637806/OptTS.txt OptTS.txt >>> >>> >>> -- > -- View this message in context: http://www.nabble.com/rsolnp--Error-%28Help%21%29-tp25637806p25652730.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] rsolnp- Error (Help!)
Thanks, Ravi. I have attached the code again. (Still the same error) http://www.nabble.com/file/p25652730/OptTS.txt OptTS.txt Ravi Varadhan wrote: > > I was trying to run your code, but it seems like you haven’t specified the > parameter called `Strk', so I was unable to run it. Can you send a fully > reproducible code? > > jholtman wrote: >> >> It means that your expression "max(tt[2] - 10 * tol, nineq)" is returning >> NA: >> >> Notice I get the same error: >> >>> if (1==1)1 >> [1] 1 >>> if (NA == 1) 1 >> Error in if (NA == 1) 1 : missing value where TRUE/FALSE needed >> >> Check your script and see why it is NA. you might need: >> >> max(tt[2] - 10 * tol, nineq, na.rm=TRUE) >> >> If your data has NAs. >> >> On Sun, Sep 27, 2009 at 5:29 PM, tushar_kul wrote: >>> >>> Hi >>> >>> I am relatively new to R and was trying to run an optimization problem >>> using >>> rsolnp. I am getting an error which seems to be not related to my >>> construct >>> of the optimization equations. >>> >>> Error in if (max(tt[2] - 10 * tol, nineq) <= 0) rho = 0 : >>> missing value where TRUE/FALSE needed >>> >>> I have attached the file code. >>> >>> I would greatly appreciate any help. >>> >>> Many thanks >>> >>> http://www.nabble.com/file/p25637806/OptTS.txt OptTS.txt >>> >>> >>> -- > -- View this message in context: http://www.nabble.com/rsolnp--Error-%28Help%21%29-tp25637806p25652730.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] rsolnp- Error (Help!)
Tushar, I was trying to run your code, but it seems like you haven’t specified the parameter called `Strk', so I was unable to run it. Can you send a fully reproducible code? Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: rvarad...@jhmi.edu Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty_personal_pages/Varadhan.html -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of tushar_kul Sent: Monday, September 28, 2009 5:24 AM To: r-help@r-project.org Subject: Re: [R] rsolnp- Error (Help!) Thanks, but I do not have "max(tt[2] - 10 * tol, nineq)" in my script. Therefore, could the error be getting generated by rsolnp itself ? jholtman wrote: > > It means that your expression "max(tt[2] - 10 * tol, nineq)" is returning > NA: > > Notice I get the same error: > >> if (1==1)1 > [1] 1 >> if (NA == 1) 1 > Error in if (NA == 1) 1 : missing value where TRUE/FALSE needed > > Check your script and see why it is NA. you might need: > > max(tt[2] - 10 * tol, nineq, na.rm=TRUE) > > If your data has NAs. > > On Sun, Sep 27, 2009 at 5:29 PM, tushar_kul wrote: >> >> Hi >> >> I am relatively new to R and was trying to run an optimization problem >> using >> rsolnp. I am getting an error which seems to be not related to my >> construct >> of the optimization equations. >> >> Error in if (max(tt[2] - 10 * tol, nineq) <= 0) rho = 0 : >> missing value where TRUE/FALSE needed >> >> I have attached the file code. >> >> I would greatly appreciate any help. >> >> Many thanks >> >> http://www.nabble.com/file/p25637806/OptTS.txt OptTS.txt >> >> >> -- >> View this message in context: >> http://www.nabble.com/rsolnp--Error-%28Help%21%29-tp25637806p25637806.html >> Sent from the R help mailing list archive at Nabble.com. >> >> __ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > > > > -- > Jim Holtman > Cincinnati, OH > +1 513 646 9390 > > What is the problem that you are trying to solve? > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > > -- View this message in context: http://www.nabble.com/rsolnp--Error-%28Help%21%29-tp25637806p25641703.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] rsolnp- Error (Help!)
I would guess so. It may have to do with the data that you are passing in. On Mon, Sep 28, 2009 at 5:23 AM, tushar_kul wrote: > > Thanks, but I do not have "max(tt[2] - 10 * tol, nineq)" in my script. > Therefore, could the error be getting generated by rsolnp itself ? > > > > jholtman wrote: >> >> It means that your expression "max(tt[2] - 10 * tol, nineq)" is returning >> NA: >> >> Notice I get the same error: >> >>> if (1==1)1 >> [1] 1 >>> if (NA == 1) 1 >> Error in if (NA == 1) 1 : missing value where TRUE/FALSE needed >> >> Check your script and see why it is NA. you might need: >> >> max(tt[2] - 10 * tol, nineq, na.rm=TRUE) >> >> If your data has NAs. >> >> On Sun, Sep 27, 2009 at 5:29 PM, tushar_kul wrote: >>> >>> Hi >>> >>> I am relatively new to R and was trying to run an optimization problem >>> using >>> rsolnp. I am getting an error which seems to be not related to my >>> construct >>> of the optimization equations. >>> >>> Error in if (max(tt[2] - 10 * tol, nineq) <= 0) rho = 0 : >>> missing value where TRUE/FALSE needed >>> >>> I have attached the file code. >>> >>> I would greatly appreciate any help. >>> >>> Many thanks >>> >>> http://www.nabble.com/file/p25637806/OptTS.txt OptTS.txt >>> >>> >>> -- >>> View this message in context: >>> http://www.nabble.com/rsolnp--Error-%28Help%21%29-tp25637806p25637806.html >>> Sent from the R help mailing list archive at Nabble.com. >>> >>> __ >>> R-help@r-project.org mailing list >>> https://stat.ethz.ch/mailman/listinfo/r-help >>> PLEASE do read the posting guide >>> http://www.R-project.org/posting-guide.html >>> and provide commented, minimal, self-contained, reproducible code. >>> >> >> >> >> -- >> Jim Holtman >> Cincinnati, OH >> +1 513 646 9390 >> >> What is the problem that you are trying to solve? >> >> __ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> >> > > -- > View this message in context: > http://www.nabble.com/rsolnp--Error-%28Help%21%29-tp25637806p25641703.html > Sent from the R help mailing list archive at Nabble.com. > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] rsolnp- Error (Help!)
Thanks, but I do not have "max(tt[2] - 10 * tol, nineq)" in my script. Therefore, could the error be getting generated by rsolnp itself ? jholtman wrote: > > It means that your expression "max(tt[2] - 10 * tol, nineq)" is returning > NA: > > Notice I get the same error: > >> if (1==1)1 > [1] 1 >> if (NA == 1) 1 > Error in if (NA == 1) 1 : missing value where TRUE/FALSE needed > > Check your script and see why it is NA. you might need: > > max(tt[2] - 10 * tol, nineq, na.rm=TRUE) > > If your data has NAs. > > On Sun, Sep 27, 2009 at 5:29 PM, tushar_kul wrote: >> >> Hi >> >> I am relatively new to R and was trying to run an optimization problem >> using >> rsolnp. I am getting an error which seems to be not related to my >> construct >> of the optimization equations. >> >> Error in if (max(tt[2] - 10 * tol, nineq) <= 0) rho = 0 : >> missing value where TRUE/FALSE needed >> >> I have attached the file code. >> >> I would greatly appreciate any help. >> >> Many thanks >> >> http://www.nabble.com/file/p25637806/OptTS.txt OptTS.txt >> >> >> -- >> View this message in context: >> http://www.nabble.com/rsolnp--Error-%28Help%21%29-tp25637806p25637806.html >> Sent from the R help mailing list archive at Nabble.com. >> >> __ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> > > > > -- > Jim Holtman > Cincinnati, OH > +1 513 646 9390 > > What is the problem that you are trying to solve? > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > > -- View this message in context: http://www.nabble.com/rsolnp--Error-%28Help%21%29-tp25637806p25641703.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] rsolnp- Error (Help!)
It means that your expression "max(tt[2] - 10 * tol, nineq)" is returning NA: Notice I get the same error: > if (1==1)1 [1] 1 > if (NA == 1) 1 Error in if (NA == 1) 1 : missing value where TRUE/FALSE needed Check your script and see why it is NA. you might need: max(tt[2] - 10 * tol, nineq, na.rm=TRUE) If your data has NAs. On Sun, Sep 27, 2009 at 5:29 PM, tushar_kul wrote: > > Hi > > I am relatively new to R and was trying to run an optimization problem using > rsolnp. I am getting an error which seems to be not related to my construct > of the optimization equations. > > Error in if (max(tt[2] - 10 * tol, nineq) <= 0) rho = 0 : > missing value where TRUE/FALSE needed > > I have attached the file code. > > I would greatly appreciate any help. > > Many thanks > > http://www.nabble.com/file/p25637806/OptTS.txt OptTS.txt > > > -- > View this message in context: > http://www.nabble.com/rsolnp--Error-%28Help%21%29-tp25637806p25637806.html > Sent from the R help mailing list archive at Nabble.com. > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] rsolnp- Error (Help!)
Hi I am relatively new to R and was trying to run an optimization problem using rsolnp. I am getting an error which seems to be not related to my construct of the optimization equations. Error in if (max(tt[2] - 10 * tol, nineq) <= 0) rho = 0 : missing value where TRUE/FALSE needed I have attached the file code. I would greatly appreciate any help. Many thanks http://www.nabble.com/file/p25637806/OptTS.txt OptTS.txt -- View this message in context: http://www.nabble.com/rsolnp--Error-%28Help%21%29-tp25637806p25637806.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.