Skip to content

isat might add each indicator individually (number of blocks = number of indicators) #38

@jkurle

Description

@jkurle

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions