Skip to content
R package for the estimation of nonlinear least squares for equation systems
Branch: master
Clone or download
JanMarvin Merge pull request #2 from JanMarvin/elast
Elasticities for the QAI Model
Latest commit 2068f29 May 12, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
R create and document function elasticities May 11, 2019
data-raw * include costs dataset Jan 20, 2016
data * include costs dataset Jan 20, 2016
man create and document function elasticities May 11, 2019
src fix importFrom Apr 28, 2019
tests test for predict Aug 1, 2018
.Rbuildignore use appveyor Jun 16, 2018
.gitignore * gitignore .dll Jan 19, 2016
.travis.yml Fix travis for MacOs Mar 3, 2019
DESCRIPTION update May 12, 2019
LICENCE Updates Jan 26, 2018
LICENSE Updates Jan 26, 2018
NAMESPACE create and document function elasticities May 11, 2019
NEWS update May 12, 2019
README.md Update README.md Apr 28, 2019
appveyor.yml
nlsur.Rproj 0.1 release. Sep 6, 2015

README.md

NLSUR

nlsur is a package to estimate a nonlinear least squares for single equations or systems of equations. The function to interact with is nlsur(). This function can estimate Nonlinear-Least Squares (NLS), Feasible Generalized NLS (FGNLS) and Iterative FGNLS (IFGNLS).

The packages supports a variety of functions like print(), coef(), summary(), logLik(), vcov() and predict().

Installation

With drat:

drat::addRepo("JanMarvin")
install.packages("readspss")

With devtools:

devtools::install_github("JanMarvin/nlsur")

Application

With nlsur() it is rather straight forward to estimate nonlinear demand systems. As example the following Translog demand system can be estimated.

data(costs)

dat <- costs
# apply a patch to create Greene Ed. 7 Data
dat$Sm[dat$Year == 1958] <- 0.61886
dat$Pe[dat$Year == 1950] <- 1.12442
dat$Pm[dat$Year == 1949] <- 1.06625

# model

model <- list(
  Sk ~ bk + dkk * log(Pk/Pm) + dkl * log(Pl/Pm) + dke * log(Pe/Pm),
  Sl ~ bl + dkl * log(Pk/Pm) + dll * log(Pl/Pm) + dle * log(Pe/Pm),
  Se ~ be + dke * log(Pk/Pm) + dle * log(Pl/Pm) + dee * log(Pe/Pm)
)

erg <- nlsur(eqns = model, data = dat, type = "FGNLS")
erg

Additional parameters may be obtained using nlcom() a wrapper for the delta method.

# indirect estimation of translog parameters
bm <- nlcom(object = erg2, form = "1 -be -bk -bl", rname= "bm")

dkm <- nlcom(object = erg2, form = "-dkk -dkl -dke", rname = "dkm")

dlm <- nlcom(object = erg2, form = "-dkl -dll -dle", rname = "dlm")

dem <- nlcom(object = erg2, form = "-dke -dle -dee", rname = "dem")

# and now dmm (nlcom can search for parameters)
dmm <- nlcom(object = erg2, form = "-dkm -dlm -dem", rname = "dmm")

Status

Build Status AppVeyor Build Status

You can’t perform that action at this time.