0

This is my data:

'data.frame':   72 obs. of  7 variables:
 $ X1       : chr  "2011M1" "2011M2" "2011M3" "2011M4" ...
 $ KPR      : int  0 0 0 0 0 0 0 0 0 0 ...
 $ LTV      : Factor w/ 3 levels "0","1","2": 1 1 1 1 1 1 1 1 1 1 ...
 $ sukubunga: num  6.5 6.5 6.5 6.5 6.5 6.5 6.5 6.5 6.5 6.5 ...
 $ inflasi  : num  0.89 0.13 -0.32 -0.31 0.12 0.55 0.67 0.93 0.27 -0.12 ...
 $ npl      : num  2.31 2.39 2.22 2.2 2.12 ...
 $ sbkredit : num  11.4 11.4 11.3 11.4 11.3 ...

i use the package glarma and this is my steps:

library(readr)
b <- read_csv("E:/b.csv")
dataku<-as.data.frame(b)
dataku$LTV<-as.factor(dataku$LTV)
dataku$LTV<-relevel(dataku$LTV,ref="0")

glmmo<-glm(KPR~LTV+sbkredit+inflasi+npl,data=dataku,family=binomial(link=logit),na.action=na.omit,x=TRUE)
summary(glmmo)

X<-glmmo$x
X<-as.matrix(X)
y1<-dataku$KPR
n1<-rep(1,length(dataku$X))
Y<-cbind(y1,n1-y1)
Y<-as.matrix(Y)

library(glarma)
glarmamo<-glarma(Y,X,phiLags=c(1),phiInit=c(0.6),type="Bin",method="FS",residuals="Pearson",maxit=100,grad=1e-6)

but, i get error :

Error in GL$cov %*% GL$ll.d : requires numeric/complex matrix/vector arguments

When i multiply GL$cov %*% GL$ll.d for so, what should i do?

PKumar
  • 10,971
  • 6
  • 37
  • 52
delta27
  • 197
  • 1
  • 7
  • 1
    Your problem is in the line `n1<-rep(1,length(dataku$X))` - this is coming out as length zero because you probably meant `dataku$X1` – Andrew Gustar May 25 '17 at 08:56
  • but, length(dataku$X) = length(dataku$X1) @AndrewGustar – delta27 May 25 '17 at 09:47
  • In your question you do not mention a variable `X` within your dataframe `dataku`, which is why I assumed `length` would fail to find it and return 0 or `NA`. – Andrew Gustar May 25 '17 at 10:08

0 Answers0