[R] Non-linear system of equations

Radka Pancheva radica at abv.bg
Fri Apr 25 10:33:09 CEST 2008


Hello R users,

I am trying to estimate the parameters of a bimodal normal distribution using moments matching, so I have to solve a non-linear system of equations. How can I solve the following simple example? 

x^2 - y^2 = 6
x – y = 3

I heard about nlsystemfit, but I don’t know how to run it exactly. I have tried the following code, but it doesn’t really work:


f1 <-y~ x[1]^2-x[2]^2-6
f2 <-z~ x[1]-x[2]-3
f  <- list(f1=0,f2=0)
nlsystemfit("OLS",f,startvals=c(0,0))

Thank You in advance for your help.

Evgeniq Petrova



More information about the R-help mailing list