r - Non-finite value supplied error with optim , while using betareg() for modeling -
while using betareg()
modeling (lgd1) got error
error in optim(par = start, fn = loglikfun, gr = gradfun, method = method, :
non-finite value supplied optim
here code i'm using don't know how download database here.
install.packages("betareg") install.packages("gtools") library(betareg) library(gtools) database<-read.csv("classeur2.csv",sep=";",header=true,stringsasfactors=false,dec=",") head(database) str(database) database[,"lgd1"]=as.numeric(database[,"lgd1"]) database[,"genre"]=as.factor(database[,"genre"]) levels(database[,"genre"])=(c("0","1")) database[,"montant.nominal.du.credit"]=as.factor(database[,"montant.nominal.du.credit"]) levels(database[,"montant.nominal.du.credit"])=(c("0","1")) database[,"typcliresid"]=as.factor(database[,"typcliresid"]) levels(database[,"typcliresid"])=(c("0","1")) database[,"typclimre"]=as.factor(database[,"typclimre"]) levels(database[,"typclimre"])=(c("0","1")) database[,"garantieh"]= as.factor(database[,"garantieh"]) levels(database[,"garantieh"])=(c("0","1")) database[,"garantiecp"]= as.factor(database[,"garantiecp"]) levels(database[,"garantiecp"])=(c("0","1")) database[,"garantieccg"]= as.factor(database[,"garantieccg"]) levels(database[,"garantieccg"])=(c("0","1")) database[,"montant.d.echeance"]=as.factor(database[,"montant.d.echeance"]) levels(database[,"montant.d.echeance"])=(c("0","1")) database[,"age.client"]=as.factor(database[,"age.client"]) levels(database[,"age.client"])=(c("0","1")) database[,"duree.du.dossier"]=as.factor(database[,"duree.du.dossier"]) levels(database[,"duree.du.dossier"])=(c("0","1")) database[,"crd.2010"]=as.factor(database[,"crd.2010"]) levels(database[,"crd.2010"])=(c("0","1")) database[,"montant.de.garantie"]=as.factor(database[,"montant.de.garantie"]) levels(database[,"montant.de.garantie"])=(c("0","1")) database$genre<-relevel(database$genre,ref="1") database$montant.nominal.du.credit<-relevel(database$montant.nominal.du.credit,ref="1") database$typcliresid<-relevel(database$typcliresid,ref="1") database$garantieh<-relevel(database$garantieh,ref="1") database$typclimre<-relevel(database$typclimre,ref="1") database$garantiecp<-relevel(database$garantiecp,ref="1") database$garantieccg<-relevel(database$garantieccg,ref="1") database$montant.d.echeance<-relevel(database$montant.d.echeance,ref="1") database$age.client<-relevel(database$age.client,ref="1") database$duree.du.dossier<-relevel(database$duree.du.dossier,ref="1") database$crd.2010<-relevel(database$crd.2010,ref="1") database$montant.de.garantie<-relevel(database$montant.de.garantie,ref="1") str(database) any(is.na(database)) database.logit <- betareg(lgd1 ~ genre+montant.nominal.du.credit+typcliresid+typclimre+garantieh+garantiecp+garantieccg+montant.d.echeance+age.client+duree.du.dossier+crd.2010+montant.de.garantie,data=database,link="logit") betareg(formula = lgd1 ~ genre+montant.nominal.du.credit+typcliresid+typclimre+garantieh+garantiecp+garantieccg+montant.d.echeance+age.client+duree.du.dossier+crd.2010+montant.de.garantie,data=database,link="logit") summary(database.logit)
error in optim(par = start, fn = loglikfun, gr = gradfun, method = method, :
non-finite value supplied optim
Comments
Post a Comment