evalModel-methods: ~~ Methods for Function 'evalModel' in Package 'gmm4' ~~

Description Usage Arguments Methods Examples

Description

Method to simply evaluate a model at a fixed coefficient vector. It creates a "gmmfit" or "gelfit" object using that fixed vector.

Usage

1
2
3
4
5
6
## S4 method for signature 'gmmModels'
evalModel(model, theta, wObj=NULL, ...)
## S4 method for signature 'gelModels'
evalModel(model, theta, lambda=NULL,
          gelType=NULL, rhoFct=NULL, lamSlv=NULL, lControl=list(),
          ...)

Arguments

model

An object of class "gmmModels".

theta

A vector of coefficients at which the model is estimated

wObj

An object of class "gmmWeights". If not provided, the optimal weights based on the specification of the model evaluated at theta will be computed.

lambda

The Lagrange multiplier vector. If not provided, the optimal vector is obtained for the given theta

gelType

The type of GEL. This argument is only used if we want to fit the model with a different GEL method. see gelModel.

rhoFct

An alternative objective function for GEL. This argument is only used if we want to fit the model with a different GEL method. see gelModel.

lamSlv

An alternative solver for the Lagrange multiplier. By default, either Wu_lam, EEL_lam, REEL_lam or getLambda is used.

lControl

A list of controls for the Lagrange multiplier algorithm.

...

Other arguments to pass. Not used for the moment.

Methods

signature(model = "gmmModels")

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
data(simData)
theta <- c(beta0=1,beta1=2)

## A linearGmm
model1 <- gmmModel(y~x1, ~z1+z2, data=simData)
evalModel(model1, c(1,1))

## A nonlinearGmm
g <- y~beta0+x1^beta1
h <- ~z1+z2
model2 <- gmmModel(g, h, c(beta0=1, beta1=2), data=simData)
evalModel(model2, theta=c(beta1=2, beta0=0.5))

## A functionGmm
fct <- function(tet, x)
    {
        m1 <- (tet[1] - x)
        m2 <- (tet[2]^2 - (x - tet[1])^2)
        m3 <- x^3 - tet[1]*(tet[1]^2 + 3*tet[2]^2)
        f <- cbind(m1, m2, m3)
        return(f)
    }
dfct <- function(tet, x)
        {
        jacobian <- matrix(c( 1, 2*(-tet[1]+mean(x)), -3*tet[1]^2-3*tet[2]^2,0, 2*tet[2],
			   -6*tet[1]*tet[2]), nrow=3,ncol=2)
        return(jacobian)
        }
model3 <- gmmModel(fct, simData$x3, theta0=c(beta0=1, beta1=2), grad=dfct)
evalModel(model3, theta=c(beta1=.1, beta0=0.3))

gmm4 documentation built on Dec. 6, 2019, 3:01 a.m.