Rで対数のCDFで改訂版

Rで対数のCDFで改訂版

wakuloglog110<-function(){


        alpha123<-par("plt")
        alpha123b<-alpha123
        alpha123b[1]<-0.2
        par(plt=alpha123b)
        alpha123

}

wakuloglog210<-function(minx,maxx,miny,maxy){

        minminx<-as.integer(log(max(c(minx,min(axTicks(1)))),10))
        maxmaxx<-as.integer(log(maxx,10))
        minminy<-as.integer(log(max(c(miny,min(axTicks(2)))),10))
        maxmaxy<-as.integer(log(maxy,10))
        #minmin<-0
        #maxmax<-6
        axis(1,at=10^(minminx:maxmaxx),tck=0.03,label=F);
        axis(1,at=10^((minminx):(maxmaxx+1))%x%1:9,tck=0.01,label=F);
        axis(3,at=10^(minminx:maxmaxx),tck=0.03,label=F);
        axis(3,at=10^((minminx):(maxmaxx+1))%x%1:9,tck=0.01,label=F);
        axis(2,at=10^(minminy:maxmaxy),tck=0.03,label=F);
        axis(2,at=10^((minminy):(maxmaxy+1))%x%1:9,tck=0.01,label=F);
        axis(4,at=10^(minminy:maxmaxy),tck=0.03,label=F);
        axis(4,at=10^((minminy):(maxmaxy+1))%x%1:9,tck=0.01,label=F);





}


wakuloglog310<-function(axis=1,axTicks=axTicks(1)){

        lab=log(axTicks,10)

        str1=paste(sep="","axis(",axis,",at=axTicks,las=",axis,",label=c(")
        str2=paste(sep="",collapse=",","expression(10^",log(axTicks,10),")");
        str3="),cex.axis=2,tck=0.03)"

        str=paste(sep="",str1,str2,str3)
        cat(str)
        #cat(axTicks)
        #cat(log(axTicks,10))
        eval(parse(text=str))


}



wakuloglog410<-function(plt=par("plt")){

        par(plt=plt)
}

midpointloglog<-function(x,y,sep=20){
        d<-as.integer(exp(seq(log(length(y)),log(1),length.out=sep)))

        points(rev(x)[d],rev(y)[d],pch=17,cex=1.5)

}



cdfloglog<-function(data,filename="tmp.eps",xlab="",ylab="CDF"){

        a<-data

        postscript(file=filename)

        a1<-wakuloglog110()

        plot(sort(a),length(a):1/length(a),log="xy",type="l",xlab="",ylab="",tck
=0.01,cex.axis=2,cex.lab=1.5,xaxt="n",yaxt="n",lwd=1.5)

        wakuloglog210(min(a),max(a),1/length(a),1);
        wakuloglog310(1,axTicks(1));
        wakuloglog310(2,axTicks(2));
        mtext(2,line=5.0,text=ylab,cex=2,font=7)
        mtext(1,line=3.0,text=xlab,cex=2,font=7)
        midpointloglog(sort(a),length(a):1/length(a))
        wakuloglog410(a1);
        dev.copy(postscript)
        dev.off()

}



#Filename=commandArgs()[1]

data=read.table(commandArgs()[5])

data<-data[,1]
cdfloglog(data,xlab=commandArgs()[6]);