[英]Random number generation but common within group
Is there a way to generate random numbers from a distribution such that these numbers are common for rows within a group? 有没有办法从分布中生成随机数,这样这些数字对于组内的行是常见的? Within an unbalanced panel, there is a household_id variable according to which I want to generate random numbers from truncated normal distribution using rtruncnorm. 在不平衡的面板中,有一个household_id变量,根据该变量,我想使用rtruncnorm从截断的正态分布中生成随机数。
Thank you. 谢谢。
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.3So, the household_id is for identifying the household in this unbalanced panel. 因此,household_id用于识别这个不平衡小组中的家庭。 Now, I want to generate random numbers using rtruncnorm such as shown, they are the same for within household cells. 现在,我想使用rtruncnorm生成随机数,如图所示,它们在家庭单元格中是相同的。
Thank you 谢谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.