nlsystemfit( method="OLS", eqns, startvals,
eqnlabels=c(as.character(1:length(eqns))), inst=NULL,
data=list(), solvtol=.Machine$double.eps, pl=0,
maxiter=1000 )nlm function.nlm and the tolerance for
detecting linear dependencies in the columns of X in the
nlm function.nlsystemfit returns a list of the class nlsystemfit.system and
contains all results that belong to the whole system.
This list contains one special object: "eq". It is a list and contains
one object for each estimated equation. These objects are of the class
nlsystemfit.equation and contain the results that belong only to the
regarding equation.
The objects of the class nlsystemfit.system and
nlsystemfit.equation have the following components (the elements of
the latter are marked with an asterisk ($*$)):b.b.b.b.rcov.b.b.b.b.nlm to perform the
minimization of the objective functions and the qr set
of functions.
A system of nonlinear equations can be written as:
$$\epsilon_{t} = q( y_t, x_t, \theta )$$
$$z_{t} = Z( x_t )$$
where $\epsilon_{t}$ are the residuals from the y observations and
the function evaluated at the parameter estimates.
The objective functions for the methods are:
typsize argument set the
absolute values of the starting values for the OLS and 2SLS
methods. For the SUR and 3SLS methods, the typsize argument is
set to the absolute values of the resulting OLS and 2SLS parameter
estimates from the nlm result structre. In addition, the starting
values for the SUR and 3SLS methods are obtained from the OLS and 2SLS
parameter estimates to shorten the number of iterations. The number of
iterations reported in the summary are only those used in the last
call to nlm, thus the number of iterations in the OLS portion of the
SUR fit and the 2SLS portion of the 3SLS fit are not included.systemfit, nlm, and qrlibrary( systemfit )
data( ppine )
hg.formula <- hg ~ exp( h0 + h1*log(tht) + h2*tht^2 + h3*elev + h4*cr)
dg.formula <- dg ~ exp( d0 + d1*log(dbh) + d2*hg + d3*cr + d4*ba )
labels <- list( "height.growth", "diameter.growth" )
inst <- ~ tht + dbh + elev + cr + ba
start.values <- c(h0=-0.5, h1=0.5, h2=-0.001, h3=0.0001, h4=0.08,
d0=-0.5, d1=0.009, d2=0.25, d3=0.005, d4=-0.02 )
model <- list( hg.formula, dg.formula )
model.ols <- nlsystemfit( "OLS", model, start.values, data=ppine, eqnlabels=labels )
print( model.ols )
model.3sls <- nlsystemfit( "3SLS", model, start.values, data=ppine,
eqnlabels=labels, inst=inst )
print( model.3sls )Run the code above in your browser using DataLab