ACCLAB/dabestr

Error in bca.ci(boot.out, conf, index[1L], L = L, t = t.o, t0 = t0.o, : estimated adjustment 'a' is NA

lijiawei88 opened this issue · 2 comments

Hello,

I recently upgraded to development version 2023.9.12 of dabestr and encountered an issue. When the dataset contains less than 5000 rows(as in my sample data, which has 5000 rows), no error occurs. However, when the number of rows exceeds 5000 (as in my sample data, which has 5002 rows), the error appears:
'Error in bca.ci(boot.out, conf, index[1L], L = L, t = t.o, t0 = t0.o, : estimated adjustment 'a' is NA'

Here is the sample code:

Data with 5000 rows:

# Create a sample data
# Define the variables and the counts
variables <- c("All Clusters", "F67:M33", "F12:M88")
counts <- c(2500, 2000, 500)

# Repeat the variables the specified number of times
variable_column <- rep(variables, times = counts)

# Generate random numbers for the value column
value_column <- runif(sum(counts), min = 0, max = 3.738943)

# Create the dataframe
data_df <- data.frame(
  variable = variable_column,
  value = value_column
)


# Prepare data for unpaired analysis and calculate median difference
unpaired.within <- load (data_df,
                             x = variable, y= value,
         idx = c("All Clusters", cluster.labels)) 
unpaired.mediandiff <- median_diff(unpaired.within)

Data with 5002 rows

# Create a sample data
# Define the variables and the counts
variables <- c("All Clusters", "F67:M33", "F12:M88")
counts <- c(2501, 2000, 501)

# Repeat the variables the specified number of times
variable_column <- rep(variables, times = counts)

# Generate random numbers for the value column
value_column <- runif(sum(counts), min = 0, max = 3.738943)

# Create the dataframe
data_df <- data.frame(
  variable = variable_column,
  value = value_column
)


# Prepare data for unpaired analysis and calculate median difference
unpaired.within <- load (data_df,
                             x = variable, y= value,
         idx = c("All Clusters", cluster.labels)) 
unpaired.mediandiff <- median_diff(unpaired.within)

In the previous version of dabestr, I could resolve this error by increasing the 'reps' value. Could you please provide some clarification or a solution for this issue in the current version?

Thank you!

Hi @lijiawei88,

In the dev version v2023.9.12 of dabestr, you may edit the "reps" value/the R parameter of the boot::boot function being called in dabestr via the "resamples" parameter in the load() function.

For example, as per your code example, simply add "resamples = 5002" into the load() function:

# Top portion on Creating Sample Data
# ...
# Prepare data for unpaired analysis and calculate median difference
unpaired.within <- load (data_df, x = variable, y = value,
         idx = c("All Clusters", "F67:M33", "F12:M88"),
         resamples = 5002) 
unpaired.mediandiff <- median_diff(unpaired.within)

For the full list of possible params for the load function, you may checkout our documentation at https://acclab.github.io/dabestr/reference/load.html.

Hope this helps :)

thanks so much for your reply. It helps. XD