[R] can optimize solve paired euqations?

jim holtman jholtman at gmail.com
Wed Dec 19 23:48:28 CET 2007


In your first case you seem to be missing a comma after the "^2"; also
missing value for 'y'.  Probably should be something like:

optimize(function(x,y)
((327.727-(1-0.114^10)*y*(1-x)/x/(1-x^y))+(9517.336-327.727
*(1+(1-x)*(1+y)/x-327.727)))^2,
interval=c(0,1), y=1)


On Dec 19, 2007 5:12 PM, Xin <jasonshi510 at hotmail.com> wrote:
> I used the command below, but R gives me the error message--syntax error.
> can anyone see the mistakes I made?
>
>
> optimize(function(x,y)
> + ((327.727-(1-0.114^10)*y*(1-x)/x/(1-x^y))+(9517.336-327.727 *(1+(1-x)*(1+y)/x-327.727)))^2
> + interval=c(0,1))
>
>
> At the same time, I use nlm() but R gives me the code
>
> $code
> [1] 3
>
> function(vals) {
>
>        x <- vals[1]
>
>        y <- vals[2]
>
>        sum(c((199.458913633542-(1-0.114^10)*y*(1-x)/x/(1-x^y)),(5234.11964684527-199.458913633542*(1+(1-x)*(1+y)/x-199.458913633542)))^2)
>
> }
>
>
>
> nlm(f, c(2,2))
>
>
>
>
>
>
>
> Any one know how to deal with this case?
>
> Thanks
>
> Xin
>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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 you are trying to solve?



More information about the R-help mailing list