全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 Gauss专版
6341 2
2006-02-17
我现在有上千组数据,要随机从中抽取500组,load到GAUSS中进行数据分析,哪位高手指点一下,我该怎么做?
二维码

扫码加我 拉你入群

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

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

全部回复
2006-2-20 03:42:00

Simple. Suppose you have 1110 groups of data (let us say vectors).

Firstly you can import all the 1110 groups into your disk and saved them in a matrix, say matrix A.

Now suppose you have 1110 rows for the matrix.

then define a 2*1110 matrix (say matrix B), 1st col for the indexes, from row 1: 1, row2:2, ..., last row: 1110.

then draw 1110*1 vector of uniform(0,1) random numbers. store this vector into the 2nd col of this matrix B.

then sort matrix B on the 2nd col, say from small to large values. then keep/choose the first 500 rows.

note that the index values corresponding the 500 rows are now disordered.

then use such indexes to help keep the vectors(groups of data) for further analysis.

----------------

Note that the above analysis is absed on the requirement that each group has the probability of 500/1110 to be selected.

and also based on the fact that you need 500 and only 500 groups.

----------------

Ensure that you understand what you really want to...

------------------

sortc(.,.) is in ascending order, to use desceding order, use rev(...)

------------------------------

[此贴子已经被作者于2006-2-20 3:44:26编辑过]

二维码

扫码加我 拉你入群

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

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

2006-2-26 10:04:00
豁然开朗,多谢指教!
二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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