Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in matrix(panel$eff, T, N) : 找不到对象'panel' #55

Open
zdlspace0528 opened this issue Feb 23, 2021 · 10 comments
Open

Error in matrix(panel$eff, T, N) : 找不到对象'panel' #55

zdlspace0528 opened this issue Feb 23, 2021 · 10 comments

Comments

@zdlspace0528
Copy link

I run your codes in your paper,I get an error,

###################################

Figure A3: Individual effects

###################################

pdf("sim_iTE.pdf",width=7,height=10)
Ntr<-out$Ntr
Y.tr<-out$Y.tr
Y.ct<-out$Y.ct
eff<-out$eff
true.effect<-matrix(out$eff,30,50)[,1:5]
Error in matrix(panel$eff, T, N) : 找不到对象'panel'

数据中并没有panel,为什么您的代码中有panel 呢

新春快乐!
Raymond

@xuyiqing
Copy link
Owner

xuyiqing commented Feb 23, 2021 via email

@zdlspace0528
Copy link
Author

Dear Pro Xu,
I run the codes of your paper to get figure A6.But I can not get confidence intervals.In your paper, You plot confidence intervals,but with your codes,there is no confidence intervals.

##############################

Figiure A6: Each State

##############################

out<-out.syn2
names(out)
time<-out$time
T0<-out$T0
T<-out$T
states<-out$id.tr

for (abb in states) { # treated states

id<-which(out$id.tr==abb)
t0<-T0[id]

pdf(paste("fg_edr_case_",abb,".pdf",sep=""),width=14,height=5)
par(mfcol=c(1,2),mar=c(4,4,1,1),lend=1)

## counterfactual
yrg<-range(c(out$Y.tr[,id],out$Y.ct[,id]))
ylim=c(yrg[1]-10,yrg[2]+5)
plot(1,type="n",xlab="",ylab='',axes=F,xlim=c(1920,2016),ylim=ylim)
box()
axis(1,at=seq(1920,2016,8));mtext("Year",1,2.5,cex=1.5)
axis(2);mtext("Turnout %",2,2,cex=1.5)
abline(v=time[t0],col="gray",lwd=2)
lines(time,out$xi+mean(out$Y.tr[,id]),col="gray50",lwd=2,lty=5)
lines(time,out$Y.tr[,id],lwd=3)  
lines(time,out$Y.ct[,id],col="gray50",lty=1,lwd=2)
text(1925,yrg[2]+2,abb,cex=2)
legend("bottomright",
       legend=c("Actual Outcome","Estimated Y(0) (DID)","Estimated Y(0) (GSC)"),
       cex=1.3, seg.len=2, col=c(1,"gray50","gray50"),lty=c(1,5,1),
       lwd=c(3,2,2),bty="n")  

yrg<-range(c(out$est.ind[,,id],out$Y.tr[,id]-out$xi-mean(out$Y.tr[,id])))
ylim<-c(yrg[1]-15,yrg[2]+5)
newx<-seq(1920,2012,4)
plot(1,type="n",xlab="",ylab='',axes=F,xlim=c(1920,2016),ylim=ylim)
box()
axis(1,at=seq(1920,2016,8));mtext("Year",1,2.5,cex=1.5)
axis(2);mtext("Turnout %",2,2,cex=1.5)
abline(v=time[t0],col="gray",lwd=2)
abline(h=0,col="gray20",lty=2,lwd=1)
lines(time,out$Y.tr[,id]-out$xi-mean(out$Y.tr[,id]),col=1,lwd=2,lty=5)
polygon(c(rev(newx), newx), c(rev(out$est.ind[ ,3,id]), out$est.ind[ ,4,id]),
        col = "#55555530", border = NA)
lines(time,out$est.ind[,1,id],col=1,lty=1,lwd=2)  
legend("bottomright",
       legend=c("Treatment Effect (DID)","Treatment Effect (GSC)",
                "95% Confidence Interval (GSC)"),
       cex=1.3, seg.len=2, col=c(1,1,"#55555550"),lty=c(5,1,1),lwd=c(2,2,15),
       bty="n")  

graphics.off()
}
image

@zdlspace0528
Copy link
Author

为什么我用您的代码之后,上面第二幅图里没有置信区间呢?

@zdlspace0528
Copy link
Author

and also there is no Treatment Effect (GSC) line.

@xuyiqing
Copy link
Owner

xuyiqing commented Feb 24, 2021 via email

@zdlspace0528
Copy link
Author

zdlspace0528 commented Mar 9, 2021 via email

@xuyiqing
Copy link
Owner

xuyiqing commented Mar 9, 2021 via email

@zdlspace0528
Copy link
Author

zdlspace0528 commented Mar 9, 2021 via email

@zdlspace0528
Copy link
Author

zdlspace0528 commented Jun 11, 2021 via email

@xuyiqing
Copy link
Owner

xuyiqing commented Jun 11, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants