随机数生成但在组内是常见的

问题描述 投票:0回答:1

有没有办法从分布中生成随机数,这样这些数字对于组内的行是常见的?在不平衡的面板中,有一个household_id变量,根据该变量,我想使用rtruncnorm从截断的正态分布中生成随机数。

谢谢。

r random numbers distribution groupwise
1个回答
0
投票

Household_id    Random number
1               0.6
1               0.6
1               0.6
2               0.1
3               0.9
3               0.9
4               0.2
5               0.7
6               0.3
6               0.3
So, the household_id is for identifying the household in this unbalanced panel. Now, I want to generate random numbers using rtruncnorm such as shown, they are the same for within household cells.

谢谢

© www.soinside.com 2019 - 2024. All rights reserved.