Displaying 1 result from an estimated 1 matches for "ctstrunk".
2011 Oct 18
1
Repeat a loop until...
...another imputed row. Of course, the problem is that the imputed value for age may be outside my acceptable range too.
If there a way to set up a loop such that it keeps checking each row until the values are within the range?
So far I have the following but this doesn't repeat the process.
ctstrunk <- function(data)
{
for(i in 1:nrow(data)){
if(data[i,2]<5)
data[i,]<-rmnorm(n=1,mean=c(mean(sanad[,1]),mean(sanad[,2]),mean(sanad[,3])),varcov=covmat)
if(data[i,2]>86)
data[i,]<-rmnorm(n=...