Relative Content

Tag Archive for rrandom

random vector with parameters in R

I’m trying to generate a random dataset in R. I am starting with a block-level (as in city blocks) dataset which has a manzent variable (block ID), a population variable, and a scholarity variable (avg of n years of education per person; range 0:14). I need this data at a person level, not block, so I need to generate random persons per block while maintaining the block-level values; this means that each unique manzent will be generating n = population rows with a random scholarity value, such that mean(scholarity) for that block == original scholarity value.