statistics

Get node list from random walk in networkX

痞子三分冷 提交于 2020-01-31 18:13:10
问题 I am new to networkX. I created a graph as follows: G = nx.read_edgelist(filename, nodetype=int, delimiter=',', data=(('weight', float),)) where the edges are positive, but do not sum up to one. Is there a built-in method that makes a random walk of k steps from a certain node and return the node list? If not, what is the easiest way of doing it (nodes can repeat)? Pseudo-code: node = random res = [node] for i in range(0, k) read edge weights from this node an edge from this node has

Text file to list in R

不问归期 提交于 2020-01-30 15:26:35
问题 I have a large text file with a variable number of fields in each row. The first entry in each row corresponds to a biological pathway, and each subsequent entry corresponds to a gene in that pathway. The first few lines might look like this path1 gene1 gene2 path2 gene3 gene4 gene5 gene6 path3 gene7 gene8 gene9 I need to read this file into R as a list, with each element being a character vector, and the name of each element in the list being the first element on the line, for example: >

Calculate the entropy of a list of 2D points in Matlab

半城伤御伤魂 提交于 2020-01-30 11:28:05
问题 I have a list of points in an array like this points = [[1,2];[2,5];[7,1]...[x,y]] The x is between 0 and 1020 and y is between 0 and 1920. How can I calculate the entropy of the points array in Matlab? Many thanks! 回答1: I assume you want to consider each [x,y] point as one data point. Let us define some exemplary data: A = [[1,2];[2,5];[7,1];[1,2]]; First we give equal points equal identifiers, we can do this using [~,~,ic] = unique(A, 'rows'); Then we compute the frequency and with that the

Best practice: How to track outbound links?

心已入冬 提交于 2020-01-29 05:12:12
问题 How do you track outbound links for your web site, since the request is logged on the destination server, not yours? 回答1: You can add a quick JQuery script to the page that will track external links and can either redirect them to a file on your server that will track the link and then forward to it, or add an ajax request that will submit on click for external links, and track them that way. See here: http://www.prodevtips.com/2008/08/19/tracking-clicks-with-jquery-and-google-analytics/ and

Best practice: How to track outbound links?

我与影子孤独终老i 提交于 2020-01-29 05:12:09
问题 How do you track outbound links for your web site, since the request is logged on the destination server, not yours? 回答1: You can add a quick JQuery script to the page that will track external links and can either redirect them to a file on your server that will track the link and then forward to it, or add an ajax request that will submit on click for external links, and track them that way. See here: http://www.prodevtips.com/2008/08/19/tracking-clicks-with-jquery-and-google-analytics/ and

PHP algorithm to generate all combinations of a specific size from a single set

别说谁变了你拦得住时间么 提交于 2020-01-25 20:39:22
问题 I am trying to deduce an algorithm which generates all possible combinations of a specific size something like a function which accepts an array of chars and size as its parameter and return an array of combinations. Example: Let say we have a set of chars: Set A = {A,B,C} a) All possible combinations of size 2: (3^2 = 9) AA, AB, AC BA, BB, BC CA, CB, CC b) All possible combinations of size 3: (3^3 = 27) AAA, AAB, AAC, ABA, ABB, ACC, CAA, BAA, BAC, .... ad so on total combinations = 27 Please

PHP algorithm to generate all combinations of a specific size from a single set

早过忘川 提交于 2020-01-25 20:39:09
问题 I am trying to deduce an algorithm which generates all possible combinations of a specific size something like a function which accepts an array of chars and size as its parameter and return an array of combinations. Example: Let say we have a set of chars: Set A = {A,B,C} a) All possible combinations of size 2: (3^2 = 9) AA, AB, AC BA, BB, BC CA, CB, CC b) All possible combinations of size 3: (3^3 = 27) AAA, AAB, AAC, ABA, ABB, ACC, CAA, BAA, BAC, .... ad so on total combinations = 27 Please

N-way ANOVA in R

一世执手 提交于 2020-01-25 11:10:52
问题 I need some help in performing N-way ANOVA in R to capture inter dependencies among different factors. In my data, there are around 100 different factors and I am using the following code to perform ANOVA. model.lm<-lm(y~., data=data) anova(model.lm) As far as I know (may be I am wrong) that this performs 1-way ANOVA at each factor alone. For some reasons, I need to perform N-way ANOVA between all the 100 groups i.e from x1 to x100. Do I need to specify each factor like the following or there

PCA of opposite sign than expected with Apache Spark

﹥>﹥吖頭↗ 提交于 2020-01-25 08:54:08
问题 I train myself with some exercices and examples from a classical statistics book, and I adapt what I learn on Apache Spark to ensure I am able to reproduce it. In a chapter of the book, the author calculates a PCA from two variables. A principal component from HiCi and SCi values of some ranking of universities, that exists in the U.S.A. The example starts with these values, and has 100 individuals : | University | X1 (HiCi) | X2 (SCi) | Harvard | 100 | 100 | Stanford | 86.1 | 70.3 | Berkeley

Defining exponential distribution in R to estimate probabilities

泪湿孤枕 提交于 2020-01-24 12:44:27
问题 I have a bunch of random variables (X1,....,Xn) which are i.i.d. Exp(1/2) and represent the duration of time of a certain event. So this distribution has obviously an expected value of 2, but I am having problems defining it in R. I did some research and found something about a so-called Monte-Carlo Stimulation, but I don't seem to find what I am looking for in it. An example of what i want to estimate is: let's say we have 10 random variables (X1,..,X10) distributed as above, and we want to