Hi all,
I found an issue which is a knife-edge case that won't occur often but it might still be good to record it in case others encounter it and are wondering whether this is intentional.
isat() creates its own blocks if they are not provided. This is done in the following:
|
if(is.null(blocks)){ |
|
blockratio.value <- ncol.adj/(ratio.threshold*ncol.adj - mXncol) |
|
blocksize.value <- ncol.adj/min(y.n*ratio.threshold, max.block.size) |
|
no.of.blocks <- max(2,blockratio.value,blocksize.value) |
|
no.of.blocks <- ceiling(no.of.blocks) |
|
no.of.blocks <- min(ncol.adj, no.of.blocks) #ensure blocks < NCOL |
|
}else{ |
|
no.of.blocks <- blocks |
|
} |
In line 316, it can happen that the denominator is 0 and hence the blockratio.value becomes infinity. Subsequently, no.of.blocksis set to ncol.adj, which is the number of indicators in the current element of ISmatrices.
Reproducible example with ncol.adj = 5 , ratio.threshold = 0.2, mXncol = 1:
y <- rnorm(20)
x <- rnorm(20)
uis <- diag(20)[, 1:5]
isat(y = y, mxreg = x, mc = FALSE, uis = uis, sis = FALSE, ratio.threshold = 0.2)
Note that I have encountered this issue with the default value of ratio.threshold = 0.8 and ncol.adj = 15, so 15 indicators were added individually and hence 15 blocks were searched. This issue can arise for any sample size (in my case 100), so it would have been feasible to simply add all 15 indicators at the same time.
I know that this is a knife-edge case and that I can simply govern the blocks myself using the blocks argument. This should probably be the solution for the users. So no immediate action is needed but we could also adjust the algorithm that determines the block size.
Hi all,
I found an issue which is a knife-edge case that won't occur often but it might still be good to record it in case others encounter it and are wondering whether this is intentional.
isat()creates its own blocks if they are not provided. This is done in the following:gets/gets/R/gets-isat-source.R
Lines 315 to 323 in 7c7ac53
In line 316, it can happen that the denominator is 0 and hence the
blockratio.valuebecomes infinity. Subsequently,no.of.blocksis set toncol.adj, which is the number of indicators in the current element ofISmatrices.Reproducible example with
ncol.adj = 5,ratio.threshold = 0.2,mXncol = 1:Note that I have encountered this issue with the default value of
ratio.threshold = 0.8andncol.adj = 15, so 15 indicators were added individually and hence 15 blocks were searched. This issue can arise for any sample size (in my case 100), so it would have been feasible to simply add all 15 indicators at the same time.I know that this is a knife-edge case and that I can simply govern the blocks myself using the
blocksargument. This should probably be the solution for the users. So no immediate action is needed but we could also adjust the algorithm that determines the block size.