Reputation: 11
head(quart)
str(quart)
#PDB PMTB RNB y
#1 391204.2 1030127 -3.10 0
#2 396498.0 1066861 1.60 0
#'data.frame': 55 obs. of 4 variables:
#$ PDB : num 391204 396498 399217 411447 399135 ...
#$ PMTB: num 1030127 1066861 1165360 1190639 1183382 ...
#$ RNB : num -3.1 1.6 3.1 0.83 0.3 0.6 -1.6 1.04 3.5 2.2 ...
#$ y : int 0 0 0 0 0 0 0 0 0 0 ...
glmMod<-glm(formula = y~PMTB+RNB, data = quart, family = binomial(link
logit),na.action = na.omit, x=TRUE)
x<-glmMod$x
X<-as.matrix(x)
y1<-quart$y
n1<-rep(1, length(quart$y))
y<-cbind(y1,n1-y1)
Y<-as.matrix(y)
library(glarma)
glarMod<-glarma(y,x,type="Bin",phiLags = c(1:2),method = "FS", maxit=100,
grad = 1e-6) #NotError
glarMod<-glarma(y,x,type="Bin",thetaLags = c(1:2),method = "FS", maxit=100,
grad = 1e-6) #Not Error
glarMod<-glarma(y,x,type="Bin",phiLags = c(1:4),method = "FS", maxit=100,
grad = 1e-6) #Error in glarma(y, x, type = "Bin", phiLags = c(1:4), method =
"FS", maxit 100, : Fisher Scoring fails to converge from the initial
estimates.
glarMod<-glarma(y,x,type="Bin",phiLags = c(1:4),thetaLags = c(1:4), method
="FS",maxit=100, grad = 1e-6) #Error in GL$cov %*% GL$ll.d : requires
numeric/complex matrix/vector arguments
I get an error in the 2 last two lines. I try to make a some combination in my glarma's model. When i try with high lag of AR and MA , I found error
Upvotes: 1
Views: 704
Reputation: 1506
Broadly speaking, the problem is the collinearity between the AR and MA model components, i.e. the choice of phiLags
and thetaLags
. Whenever these arguments share similar components (1,2,3,4 in your code), model parameters are introduced which are interdependent. When these model parameters are to be estimated, convergence issues arise in the underlying numerical optimization procedure.
Therefore, the list/vector components of phiLags
and thetaLags
are required to be non-overlapping. This is the very reason why phiLags
and thetaLags
are to be specified as a list/vector in the GLARMA package, rather than by the maximum order p
and q
as it is the case for most ARMA-like model specifications in . other libraries. Unfortunately, this is not sufficiently documented in https://cran.r-project.org/web/packages/glarma/glarma.pdf or the vignette.
In summary, you simply have to choose which component gets which lag. For example,
phiLags = c(1:2), thetaLags = c(3:4)
works, as the sets are non-overlapping. The same holds true for
phiLags = c(1,3), thetaLags = c(2,4)
etc.
Moreover, this explains why you didn't get convergence errors when assigning all lags to the MA or AR-component respectively.
Note, however, that the GLARMA model is inherently numerically unstable when comes to the Binomial response, as in your case. Therefore, great care and patience are required when choosing the appropriate lags.
Upvotes: 1