12
I have a grafo
and calculated the distribution of degrees and degree as follows:
dd <- degree_distribution(graph)
d <- degree(graph)
From that, I cherished the Power Law
, to see if my distribution follows the "Power Law" :
degree = 1:max(d)
probability = dd[-1]
# Exclui zeros, pois log de 0 é infinito!
nonzero.position = which(probability != 0)
probability = probability[nonzero.position]
degree = degree[nonzero.position]
reg = lm(log(probability) ~ log(degree))
cozf = coef(reg)
#Estima a power law com base nos valores
power.law.fit = function(x) exp(cozf[[1]] + cozf[[2]] * log(x))
From that, I plotted the dots and the power law
using the ggplot2
.
Resulting in the following image:
df <- data.frame(x = degree, y = probability)
print(
ggplot(df, aes(x,y,colour="Distribuição"))+
geom_point(shape = 4) +
stat_function(fun = power.law.fit, geom = "line", aes(colour="Power Law"))+
labs(title = "Grafo", subtitle = "Distribuição dos Graus",
x="K", y="P(k)", colour="Legenda")+
scale_color_brewer(palette="Dark2")
)
As you can see, my distribution does not follow the Power Law
! I would like to estimate the distribution of Poisson
and plot on the same chart.
Even though I’m not sure that my distribution does not follow (or follow) the Poisson
, would like to plot along with the Power Law
. I have no idea how to estimate this distribution (Poisson
) from the data, and calculate the average grade.
Could someone help me? Thank you.
- The graph used to calculate the distribution and the degree is very large (700,000 vertices), so I did not put the graph data. The answer explanation can be based on any graph.
Filipe, although the question is well formulated, it seems to escape the scope of the site unfortunately, because it deals more with statistics than programming.
– Carlos Cinelli
I do not believe that escape the scope, statistics is part of programming, and the tag itself
r
saysR é um ambiente e linguagem de programação de código aberto para computação estatística...
– Raizant
I also agree @knautiluz. I hope someone helps me kk. Grateful.
– Fillipe
@Statistical knautiluz is not part of the programming. Statistical questions are outside the scope of the website. See more here https://pt.meta.stackoverflow.com/questions/4266/comorlidar-com-uma-questiona-que-depende-acquaintance_além-programming/4355#4355
– Carlos Cinelli
He asked using language
r
, which is a programming language focused on statistics, although the question is more focused on statistics. In most programming colleges we have to learnestatística
in order to be able to deal with certain cases involving programming. I understood what you said, but I still don’t believe it to escape the scope. Now about the Cross Validated yes, really it would be better answered there, I think it could have been commented at first.– Raizant