search for: howmanymiss

Displaying 2 results from an estimated 2 matches for "howmanymiss".

2011 Jun 01
1
Missing completely at random
...lt;- 12           ####number of variables X <- matrix(rnorm(N * n), N, n)    ####matrix pMiss <- 0.05     ####percent of missing values idMiss <- sample(1:N, N * pMiss)    ####sample cases nMiss <- length(idMiss) m <- 3    ####maximum number of missing variables within selected cases howmanyMiss <- sapply(idMiss, function(x) sample(1:m, 1)) howmanyMiss lapply(howmanyMiss, function(x) sample(1:n, x))   Any suggestion? Thanks, Blaž [[alternative HTML version deleted]]
2011 Jun 03
3
Not missing at random
Hello!   I would like to sample 30 % of cases (with at least 1 value lower than 3) and among them I want to set all values lower than 3 (within selected cases) as NA (NMAR- Not missing at random). I managed to sample cases, but I don’t know how to set values (lower than 3) as NA.   R code:   x <-