全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
1683 1
2011-11-22

LetX be a matrix of random normal values (mean =0; sd=1) having 10 columns andN=100 rows. Reset the values in the first row in the matrix to(1,1.5,1.4,3,1.9,4,4.9,2.6,3.2,2.4). Assume that the first 5 columns of datafor each row correspond to a group A, while the remaining 5 to another group B.

1.) For each row of the matrix X, compute:

a) the t-statistic comparing the groups A and B assuming equalvariance and the p-value


b) Compute theprobability to observe such a t-statistics only by chance, using a permutationanalysis. The following strategy will be used: the columns will be randomlypermuted nk=1000 times, and at each iteration the t-statistic will be computedagain and recorded in a vector. At the end, compute the p-value as the numberof times out of nk when the t-statistic with the permuted data was at least asor more extreme than the t-statistics obtained with the real (non-permuteddata).   

Present the result as a data.frame with 4 columns: ID= Row number,t= t-score, p_theoretical=p-value assuming the asymptotic distribution;p_permutations=p-value from permutations;

Sort the data.frame in descending order of p-values.

2.) Plot the distribution (see hist)of the resulting vector of t-scores obtained at step 1a) after excluding the first element (correspondingto the first row) and on the same graph show a vertical line for the t-value ofthe first row.


二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2015-1-7 14:50:03
可以发到项目交易或者发起悬赏
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群