I'm performing multilevel analysis and, to check for statistical artifacts, I want to create new group level variables adding random noise to some group level variables (like school-level socioeconomic composition).
In R
, the jitter()
function allows to add random noise to a column easily:
jittered_variable <- jitter(variable)
However, this function add different values to a group level variable within groups.
Is there any way in R
to add the same random noise to a group level variable within groups? For example, +0.5 for all the members of group 1, -0.3 for all the members of group 2, and so on.
Aucun commentaire:
Enregistrer un commentaire