data(agres)
# estimation without control options
mycode <- list(
GVA~quec(NPATENT,1,15),
PPI~quec(NPATENT,0,13)+quec(GVA,0,14),
ENTR_INCOME~quec(NPATENT,0,14)+quec(GVA,1,14)
)
myfit <- dlsem(mycode,group="COUNTRY",exogenous=c("GDP","FARM_SIZE"),data=agres,
uniroot.check=TRUE,imputation=FALSE,log=TRUE)
### adaptation of lag shapes (may take some seconds more)
## model code
#mycode <- list(
# GVA~quec(NPATENT,0,15),
# PPI~quec(NPATENT,0,15)+quec(GVA,0,15),
# ENTR_INCOME~quec(NPATENT,0,15)+quec(GVA,0,15)
# )
#
## control options
#mycontrol <- list(
# adapt=c(GVA=TRUE,PPI=TRUE,ENTR_INCOME=TRUE),
# max.gestation=list(GVA=c(NPATENT=3),PPI=c(NPATENT=3,GVA=3),ENTR_INCOME=c(NPATENT=3,GVA=3)),
# min.width=list(GVA=c(NPATENT=5),PPI=c(NPATENT=5,GVA=5),ENTR_INCOME=c(NPATENT=5,GVA=5)),
# sign=list(GVA=c(NPATENT="+"),PPI=c(NPATENT="-",GVA="-"),ENTR_INCOME=c(NPATENT="+",GVA="+"))
# )
#
#myfit <- dlsem(mycode,group="COUNTRY",exogenous=c("GDP","FARM_SIZE"),data=agres,
# control=mycontrol,uniroot.check=TRUE,imputation=TRUE,log=TRUE)
# summaries of estimation
summary(myfit)
# display the DAG with significant edges only
plot(myfit)
Run the code above in your browser using DataLab