Learn R Programming

diseq (version 0.3.1)

scores: Likelihood scores.

Description

It calculates the gradient of the likelihood at the given parameter point for each observation in the sample. It, therefore, returns an n x k matrix, where n denotes the number of observations in the sample and k the number of estimated parameters. There order of the parameters is the same as the one that is used in the summary of the results.

Usage

scores(object, parameters)

# S4 method for diseq_basic scores(object, parameters)

# S4 method for diseq_deterministic_adjustment scores(object, parameters)

# S4 method for diseq_directional scores(object, parameters)

# S4 method for diseq_stochastic_adjustment scores(object, parameters)

# S4 method for equilibrium_model scores(object, parameters)

Arguments

object

A model object.

parameters

A vector with model parameters.

Value

The score matrix.

Examples

Run this code
# NOT RUN {
model <- simulate_model(
  "diseq_basic", list(
    # observed entities, observed time points
    nobs = 500, tobs = 3,
    # demand coefficients
    alpha_d = -0.9, beta_d0 = 8.9, beta_d = c(0.6), eta_d = c(-0.2),
    # supply coefficients
    alpha_s = 0.9, beta_s0 = 4.2, beta_s = c(0.03, 1.2), eta_s = c(0.1)
  ),
  seed = 7523
)

# estimate the model object (BFGS is used by default)
est <- estimate(model)

# Calculate the score matrix
head(scores(model, est@coef))
# }

Run the code above in your browser using DataLab