Skip to content

Commit 2115eb8

Browse files
committed
Added distribution.R file
1 parent 95e97e6 commit 2115eb8

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

tools/distribution.R

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
3+
library("VGAM")
4+
args <- commandArgs(trailingOnly=TRUE);
5+
print(args[1]);
6+
data <- as.matrix(read.table(paste(args[1],sep=''),header=T))
7+
n = sum(!is.na(data))
8+
data.ecdf = ecdf(data)
9+
data.mean = mean(data)
10+
data.median = median(data)
11+
data.max = max(data)
12+
data.min = min(data)
13+
14+
postscript(args[2])
15+
#plot(data.ecdf, xlab = args[3], ylab = "cumulative probability", main = '', log="x", xlim=c(1,data.max))
16+
print(max(data))
17+
h <- hist(data, plot=F, breaks=c(seq(0,max(data)+1, 1)))
18+
par(mar=c(6.0,5.1,1.1,1.1))
19+
plot(h$counts, log="xy", pch=20, col="black",
20+
main="",
21+
xlab="Degree", ylab="Frequency", cex.lab=3, cex.axis=2.5 )
22+
degValues <- seq(1:10000)
23+
#geosequence <- 10000*dgeom(degValues, 0.12, log=FALSE)
24+
#lines(geosequence, col="limegreen", lwd=3)
25+
#legend(1, 50, c("Datagen", "Geometric"),
26+
# cex=3, col=c("black","limegreen"),
27+
# lty=c(0,1), pch=c(20,NA), lwd=3)
28+
geosequence <- 1000000*dzeta(degValues, 0.7, log=FALSE)
29+
lines(geosequence, col="brown4", lwd=3)
30+
#legend(1, 15, c("Datagen", "Zeta"),
31+
# cex=3, col=c("black","brown4"),
32+
# lty=c(0,1), pch=c(20,NA), lwd=3)
33+
#
34+
dev.off()

0 commit comments

Comments
 (0)