在度分布图

时间:2015-11-27 08:02:58

标签: r plot distribution

我绘制度数分布图并在其上拟合幂律,但是我不想拟合幂律,而是想在图的中点绘制平滑曲线。所以我需要帮助,如何在度数分布上拟合平滑的曲线?我的代码和图表如下。 代码:

rm(list=ls())
options(max.print = 10000000)
library(igraph)

Binr<- read.delim("E:/M.Tech 3rd         sem/Thesis/Dataset/BINARY_PROTEIN_PROTEIN_INTERACTIONS.txt", na.strings="-",
              header=F, comment.char = "" , fill = TRUE , sep = "\t" )
Binrppi <- Binr[complete.cases(Binr),]
d_f <- data.frame(Binrppi$V1 , Binrppi$V4);d_f
lvl <- d_f[as.character(d_f[,1])!= as.character(d_f[,2]),];lvl
g <- graph.data.frame(lvl,directed = FALSE)
d <- degree(g)
degree <- sort(d, decreasing = TRUE)
dd <- degree.distribution(g, cumulative = FALSE)
degree <- 1:max(d);degree
probability <- dd[-1] ; probability
nonzero.position = which(probability != 0)
probability = probability[nonzero.position]
degree = degree[nonzero.position];degree
reg = lm(log(probability) ~ log(degree)) ; reg
cozf = coef(reg);cozf
summary(reg)
alpha = -cozf[[2]]; alpha
R.square = summary(reg)$r.squared
R.square
lo <- loess(degree ~ probability );lo
plot(probability ~ degree, log = "xy", xlab = "Degree", ylab = "Probability (log)", 
 col = "blue", main = "Degree Distribution")
xl <- seq(min(probability),max(probability), (max(probability) -     min(probability))/1000); xl
lines(xl, predict(lo,xl), col='red', lwd=2)

图表: This the plot of degree distribution.

在这个情节中,我想要一个中间点的平滑曲线,如从2度到50度 我的数据集太大了,这就是我无法在此处上传的原因。其PPI数据集。

感谢您提前提供任何帮助。

您好,我在这里发布了一小部分数据集。发布前100个交互。      Binrppi.V1 Binrppi.V4      2 ITGA7 CHRNA1     3 PPP1R9A ACTG1     4 SRGN CD44     5 GRB7 ERBB2     6 PAK1 ERBB2     7 DLG4 ERBB2     8 PIK3R2 ERBB2     9 PTPN18 ERBB2     10 ERBB2IP ERBB2     11 SMURF2 ARHGAP5     12 NF2 ERBB2     13 CD82 ERBB2     14 ERRFI1 ERBB2     15 MMP7 CD44     16 TOB1 ERBB2     17 MUC4 ERBB2     18 PICK1 ERBB2     19 SMURF2 TXNIP     20 DDX20 ETV3     21 TLE1 FOXG1     22 TLE3 FOXG1     23 HDAC1 FOXG1     24 SMAD1 FOXG1     25 KDM5B FOXG1     26 CD4 CD44     27 SMURF2 DAB2     28 CBL VAV1     29 PLCG1 VAV1     30 PRLR VAV1     31 TYK2 VAV1     32 SMURF2 DGCR2     33 MAPK1 VAV1     34 VAV1 RHOG     35 HRAS VAV1     36 BTK VAV1     37 TGFBR1 CD44     38 SYK VAV1     39 SHB VAV1     40 PRKCQ VAV1     41 TEC VAV1     42 IL6ST VAV1     43 HNRNPK VAV1     44 SLA VAV1     45 PTK2B VAV1     46 EZH2 VAV1     47 LCP2 VAV1     48 TGFBR2 CD44     49 ZYX VAV1     50 SH3BP2 VAV1     51 SIAH2 VAV1     52拉特VAV1     53 ARHGDIB VAV1     54 SOCS1 VAV1     55 AOC3 VAV1     56 NEK3 VAV1     57 CBLB VAV1     58 BLNK VAV1     59 VAV2 CD44     60 RACGAP1 VAV1     61 PAG1 VAV1     62 DOCK2 VAV1     63 SMURF2 FAM175B     64 SMURF2 ACBD3     66 PECAM1 YES1     67 CD36 YES1     68 RPL10 YES1     69 MST1R YES1     70 ERBB4 CD44     71 TYRO3 YES1     72 ADAM12 YES1     73 NPHS1 YES1     74 OCLN YES1     75 DLG4 YES1     76 CD2AP YES1     77 TRPV4 YES1     78 SMURF2 SF3A2     79 GP6 YES1     80 TP53BP2 YES1     81 TIAM1 CD44     82 SP1 REL     83 ELF1 REL     84 SMURF2 ACOX3     85 SMURF2 RNF111     86 NKRF REL     87 TBP REL     88 SMURF2 TMEM139     89 SMURF2 LAPTM5     90 MAPK8 REL     91 SMURF2 SNRNP70     92 DMP1 CD44     93 PPP4C REL     94 NUP155 ZFYVE9     95 SUMF2 ZFYVE9     96 ETS2 ZFYVE9     97 SMAD7 ZNF107     98 SMAD7 ZBTB44     99 SMAD7 TTF2     100 HSPA8 REL     101 SMAD7 MYOD1     102 GTF2B REL

0 个答案:

没有答案