Description Usage Arguments Value Author(s) References Examples
View source: R/grad_hess_beta.R
This function calculates the gradient and Hessian of the log-likelihood with respect to beta.
1 | grad_hess_beta(Y, X, beta0, gamma0)
|
Y |
Observation matrix |
X |
Design matrix |
beta0 |
Initial beta vector |
gamma0 |
Initial gamma vector |
grad_L_beta |
Vector of the gradient of L with respect to beta |
hess_L_beta |
Matrix of the Hessian of L with respect to beta |
Marina Gomtsyan, Celine Levy-Leduc, Sarah Ouadah, Laure Sansonnet
Maintainer: Marina Gomtsyan <marina.gomtsyan@agroparistech.fr>
M. Gomtsyan et al. "Variable selection in sparse GLARMA models", arXiv:2007.08623v1
1 2 3 4 5 6 7 8 9 10 11 12 | n=50
p=30
X = matrix(NA,(p+1),n)
f = 1/0.7
for(t in 1:n){X[,t]<-c(1,cos(2*pi*(1:(p/2))*t*f/n),sin(2*pi*(1:(p/2))*t*f/n))}
gamma0 = c(0)
data(Y)
glm_pois<-glm(Y~t(X)[,2:(p+1)],family = poisson)
beta0<-as.numeric(glm_pois$coefficients)
result = grad_hess_beta(Y, X, beta0, gamma0)
grad = result$grad_L_beta
Hessian = result$hess_L_beta
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.