plm: Fit parameterized linear models

Description Usage Arguments Value Examples

View source: R/plm.R

Description

The optimal model is fit in a case where aside from some parameters, the model is linear. Numerical optimization is used over these parameters with stats::lm()() fitting the rest.

Usage

1
2
plm(formula, data = parent.frame(), params = c(), optimize = TRUE,
  .ocall = NULL, method = "nlm", ..., debug = FALSE)

Arguments

formula

a formula describing the model

data

a data frame

params

a named vector of the parameters to be fit by numerical optimation outside of stats::lm()().

optimize

a logical indicating whether params should be plugged in or used as the seed for the numerical optimization

.ocall

used for recursive calling

...

additional arguments, currently ignored.

Value

On object of class c("plm", "lm") which is an enhanced "lm" object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
if( require(EconData) & require(dplyr) ) {
plm( log(iGDP) - log(iK) ~ iYear,
     data=Calvin %>% filter(Country=="US"))

plm( log(iGDP) - delta * iK - (1-delta) * iL ~ iYear,
     data=Calvin %>% filter(Country=="US"),
     params=c(delta=0.4),
     optimize=FALSE )

plm( log(iGDP) - delta * iK - (1-delta) * iL ~ iYear, data=Calvin %>% filter(Country=="US"),
     params=c(delta=0.4),
     optimize=TRUE )

plm( log(iGDP) - delta * iK - (1-delta) * iL ~ iYear, data=Calvin %>% filter(Country=="US"),
     params=c(delta=0.4), method=c("nlm", "spg"),
     optimize=TRUE )

foo <- plm( log(iGDP / delta*(delta_1*iK + (1-delta_1)*iL) + (1-delta)*iQp) ~ iYear,
            data=Calvin %>% filter(Country=="US"),
            params=c(delta=0.5, delta_1=0.5))
foo
class(foo)
}

EconModels/MacroGrowth documentation built on Dec. 17, 2019, 10:41 p.m.