Antti Simola
2012-Nov-20 09:24 UTC
[R] Coefficient of determination for non-linear equations system (nlsystemfit)
Hello everyone, I have estimated system of three linear equations with one non-linear restrictions with nlsystemfit. I was wondering how I can calculate the R-squared (or some alternative coefficient of determination) for the whole system. This is automatically given by linear systemfit but not by nlsystemfit. I can get the values for each of the equations separately, but apparently not for the whole system. I'm also wondering why separate equations' objects all appear in together with a command like: nl.system <- nlsystemfit() nl.system$eq[i] but e.g. the following produces NULL as the value for the individual objects, e.g. R-squared eq.1 <- nl.system$eq[1] eq.1$r2 Cheers, Antti
Arne Henningsen
2012-Nov-24 20:57 UTC
[R] Coefficient of determination for non-linear equations system (nlsystemfit)
Dear Antti On 20 November 2012 10:24, Antti Simola <asimola78 at gmail.com> wrote:> I have estimated system of three linear equations with one non-linear > restrictions with nlsystemfit.Please read the FAQ at http://www.systemfit.org/> I was wondering how I can calculate the > R-squared (or some alternative coefficient of determination) for the whole > system. This is automatically given by linear systemfit but not by > nlsystemfit. I can get the values for each of the equations separately, but > apparently not for the whole system.You have to do this manually, e.g. by equation (43) in the paper: http://www.jstatsoft.org/v23/i04/paper> I'm also wondering why separate equations' objects all appear in together > with a command like: > > nl.system <- nlsystemfit() > > nl.system$eq[i] > > but e.g. the following produces NULL as the value for the individual > objects, e.g. R-squaredAs the "eq" component is a "list" (see documentation), you must use double brackets: nl.system$eq[[i]]> eq.1 <- nl.system$eq[1] > > eq.1$r2You can directly use: nl.system$eq[[i]]$r2 Best wishes from Copenhagen, Arne -- Arne Henningsen http://www.arne-henningsen.name