Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/JanMarvin/nlsur
R package for the estimation of nonlinear least squares for equation systems
https://github.com/JanMarvin/nlsur
equation-systems fgnls ifgnls nls r r-package seemingly-unrelated-regression
Last synced: 30 days ago
JSON representation
R package for the estimation of nonlinear least squares for equation systems
- Host: GitHub
- URL: https://github.com/JanMarvin/nlsur
- Owner: JanMarvin
- License: other
- Created: 2017-08-02T16:15:28.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2024-08-13T16:51:15.000Z (4 months ago)
- Last Synced: 2024-08-13T20:07:44.405Z (4 months ago)
- Topics: equation-systems, fgnls, ifgnls, nls, r, r-package, seemingly-unrelated-regression
- Language: R
- Homepage:
- Size: 4.47 MB
- Stars: 15
- Watchers: 5
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: NEWS
- License: LICENSE
Awesome Lists containing this project
README
# NLSUR ![R-CMD-check](https://github.com/JanMarvin/nlsur/workflows/R-CMD-check/badge.svg)
`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
Via `r-universe`:
```R
install.packages("nlsur", repos = c("https://janmarvin.r-universe.dev", "https://cloud.r-project.org"))
```Via `devtools`:
```R
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.
```R
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.
```R
# indirect estimation of translog parameters
bm <- nlcom(object = erg, form = "1 -be -bk -bl", rname = "bm")
dkm <- nlcom(object = erg, form = "-dkk -dkl -dke", rname = "dkm")
dlm <- nlcom(object = erg, form = "-dkl -dll -dle", rname = "dlm")
dem <- nlcom(object = erg, form = "-dke -dle -dee", rname = "dem")# and now dmm (nlcom can search for parameters)
dmm <- nlcom(object = erg, form = "-dkm -dlm -dem", rname = "dmm")
```