R version 2.10.0 (2009-10-26) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(MASS) > > firms <- c("MYLAN","NOVOPHARM","LEMMON","GENEVA","COPLEY_PHARM","ROXANE_LABS", + "PUREPAC_PHARM","WATSON_LABS","MUTUAL_PHARM","OTHER") > > ps.options(horizontal=FALSE,onefile=FALSE) > ps.options(pagecentre=TRUE) > ps.options(paper="letter") > ps.options(width=7.0,height=9.0) > > filename <- "an.usrvar.flt.Xave.dat" > > tmp <- scan(filename) Read 125 items > rows <- tmp[1] > cols <- tmp[2] > Xave <- matrix(tmp[3:(2+rows*cols)],nrow=rows,ncol=cols) > > nfirm <- rows > > filename <- "an.usrvar.flt.Yave.dat" > > tmp <- scan(filename) Read 289 items > rows <- tmp[1] > cols <- tmp[2] > Yave <- matrix(tmp[3:(2+rows*cols)],nrow=rows,ncol=cols) > > filename <- "an.usrvar.flt.Acer.dat" > > tmp <- scan(filename) Read 131 items > rows <- tmp[1] > cols <- tmp[2] > Acer <- matrix(tmp[3:(2+rows*cols)],nrow=rows,ncol=cols) > > filename <- "an.usrvar.flt.Aave.dat" > > tmp <- scan(filename) Read 125 items > rows <- tmp[1] > cols <- tmp[2] > Aave <- matrix(tmp[3:(2+rows*cols)],nrow=rows,ncol=cols) > > logCu <- Xave > A <- Yave[1:nfirm,] > logCk <- Yave[(nfirm+1):(nfirm+nfirm),] > logPi <- Yave[nfirm+nfirm+1,] > > logC <- logCu + logCk > > maxlogC <- max(logC) > minlogC <- min(logC) > > maxlogPi <- max(logPi) > minlogPi <- min(logPi) > > n <- ncol(logC) > > idx <- seq(1,n) > > maxidx <- max(idx) > minidx <- min(idx) > > N <- mat.or.vec(1,n) > for (i in 1:nfirm) N <- N + A[i,] > > offset <- 0.5 > > loline <- mat.or.vec(1,n) > for (i in 1:n) loline[i] <- min(logPi-offset) > > filename <- paste("an.usrvar.flt.logCR.",nfirm,"f.eps",sep="") > postscript(file=filename) > par(mfrow=c((nfirm+1),1),mar=c(2.5,4,1.6,2)+0.1) # mar=c(bottom,left,top,right) > > for (i in 1:nfirm) { + plot(c(minidx,maxidx),c(minlogC-maxlogPi,maxlogC-minlogPi), + type="n",xlab="",ylab="") + title(paste(firms[i],"'s log cost - log total revenue ",sep="")) + lines(idx,logC[i,]-logPi,lty="solid") + for (j in 1:n) { + if (A[i,j] == 1) { points(idx[j],logC[i,j]-logPi[j],pch="o") } + } + } > > plot(c(idx,idx),c(logPi,logPi-offset),type="n",xlab="",ylab="") > title("log total revenue") > lines(idx,logPi,lty="solid") > points(idx,loline+0.1,pch=as.character(N)) > > dev.off() null device 1 > > filename <- paste("an.usrvar.flt.logC.",nfirm,"f.eps",sep="") > postscript(file=filename) > par(mfrow=c((nfirm+1),1),mar=c(2.5,4,1.6,2)+0.1) # mar=c(bottom,left,top,right) > > for (i in 1:nfirm) { + plot(c(minidx,maxidx),c(minlogC,maxlogC),type="n",xlab="",ylab="") + title(paste(firms[i],"'s log cost",sep="")) + lines(idx,logC[i,],lty="solid") + for (j in 1:n) { + if (A[i,j] == 1) { points(idx[j],logC[i,j],pch="o") } + } + } > > plot(c(idx,idx),c(logPi,logPi-offset),type="n",xlab="",ylab="") > title("log total revenue") > lines(idx,logPi,lty="solid") > points(idx,loline+0.1,pch=as.character(N)) > > dev.off() null device 1 > > ps.options(horizontal=FALSE,onefile=FALSE) > ps.options(pagecentre=TRUE) > ps.options(paper="letter") > ps.options(width=7.0,height=5.0) > > offset <- 0.15 > for (i in 1:n) loline[i] <- -offset > > filename <- paste("an.usrvar.flt.Acer.",nfirm,"f.eps",sep="") > postscript(file=filename) > par(mfrow=c((nfirm),1),mar=c(2.5,4,1.6,2)+0.01) # mar=c(bottom,left,top,right) > > for (i in 1:nfirm) { + plot(c(minidx,maxidx),c(-offset,1), + type="n",xlab="",ylab="") + title(paste(firms[i],"'s classification error rate ",sep="")) + lines(idx,Acer[i,1:n],lty="solid") + points(idx,loline,pch=as.character(A[i,])) + } > > print(" ") [1] " " > print("cer per firm") [1] "cer per firm" > print(" ") [1] " " > print(Acer[,n+1]) [1] 0.10956555 0.09627477 0.11837843 > print("overall cer") [1] "overall cer" > print(Acer[1,n+2]) [1] 0.1080729 > > dev.off() null device 1 > > filename <- paste("an.usrvar.flt.Aave.",nfirm,"f.eps",sep="") > postscript(file=filename) > par(mfrow=c((nfirm),1),mar=c(2.5,4,1.6,2)+0.01) # mar=c(bottom,left,top,right) > > for (i in 1:nfirm) { + plot(c(minidx,maxidx),c(0,1), + #plot(c(minidx,maxidx),c(-offset,1), + type="n",xlab="",ylab="") + title(paste(firms[i],"'s entry decisions",sep="")) + #lines(idx,Aave[i,1:n],lty="solid") + points(idx,Aave[i,],pch="x") + #points(idx,loline,pch=as.character(A[i,])) + points(idx,A[i,],pch="o") + } > > print(" ") [1] " " > print("cer per firm") [1] "cer per firm" > print(" ") [1] " " > print(Acer[,n+1]) [1] 0.10956555 0.09627477 0.11837843 > print("overall cer") [1] "overall cer" > print(Acer[1,n+2]) [1] 0.1080729 > > dev.off() null device 1 > > > proc.time() user system elapsed 0.243 0.023 0.262