grad_hess_L_gamma {MultiGlarmaVarSel}R Documentation

Gradient and Hessian of the log-likelihood with respect to gamma

Description

This function calculates the gradient and Hessian of the log-likelihood with respect to gamma

Usage

grad_hess_L_gamma(Y, X, eta, gamma, I, J)

Arguments

Y

Observation matrix

X

Design matrix

eta

Initial eta vector

gamma

Initial gamma vector

I

Number of conditions

J

Number of replications

Value

grad_L_gamma

Vector of the gradient of L with respect to gamma

hess_L_gamma

Matrix of the Hessian of L with respect to gamma

Author(s)

Marina Gomtsyan

Maintainer: Marina Gomtsyan <marina.gomtsyan@agroparistech.fr>

References

M. Gomtsyan et al. "Variable selection in sparse multivariate GLARMA models: Application to germination control by environment", arXiv:2208.14721

Examples

data(Y)
I=3
J=100
T=dim(Y)[2]
q=1
X=matrix(0,nrow=(I*J),ncol=I)
for (i in 1:I)
{
  X[((i-1)*J+1):(i*J),i]=rep(1,J)
}
gamma_0 = matrix(0, nrow = 1, ncol = q)
eta_glm_mat_0 = matrix(0,ncol=T,nrow=I)
for (t in 1:T)
{
  result_glm_0 = glm(Y[,t]~X-1,family=poisson(link='log'))
  eta_glm_mat_0[,t]=as.numeric(result_glm_0$coefficients)
}
eta_0 = round(as.numeric(t(eta_glm_mat_0)),digits=6)
result = grad_hess_L_gamma(Y, X, eta_0, gamma_0, I, J)
grad = result$grad_L_gamma
Hessian = result$hess_L_gamma

[Package MultiGlarmaVarSel version 1.0 Index]