Hi all can any one of you write a script for the following problem Let X be a matrix of random normal values (mean =0; sd=1) (see rnorm() function) having 10 columns and N=100 rows. Let the first row in the matrix be (1,1.5,1.4,3,1.9,4,4.9,2.6,3.2,2.4). Assume that the first 5 columns of data for each row correspond to a group A, while the remaining 5 to another group B.
For each row of the matrix X, compute: a) the t-statistic comparing the groups A and B assuming equal variance b) Compute the probability to observe such a t-statistics only by chance, using a permutation analysis. The following strategy will be used: the columns will be randomly permuted nk=100 times, and at each iteration the t-statistic will be computed again and recorded in a vector. At the end, compute the p-value as the number of times out of nk when the t-statistic with the permuted data was at least as or more extreme than the t-statistics obtained with the real (non-permuted data). Present the result as a dataframe with 3 columns: ID= Row number, t= t-score, p=p-value; -- View this message in context: http://www.nabble.com/help-neede-fast-tp20555476p20555476.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.