QuestVar¶
questvar._api.QuestVar ¶
Configurable QuEStVar analysis object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
TestConfig, dict, or None
|
Configuration object or dict. If None, uses defaults. |
None
|
**kwargs
|
Any
|
Override individual config fields (cv_thr, p_thr, etc.). |
{}
|
Source code in src/questvar/_api.py
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 | |
Functions¶
from_yaml
classmethod
¶
Load config from a YAML file and return a QuestVar instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path to a YAML config file. |
required |
Returns:
| Type | Description |
|---|---|
QuestVar
|
|
Source code in src/questvar/_api.py
test ¶
Run a pairwise equivalence and difference test.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
DataFrame or ndarray
|
Input data. Polars DataFrame with sample columns, or numpy array. |
required |
cond_1
|
list of str or list of int
|
Column names (DataFrame) or indices (ndarray) for condition 1. |
required |
cond_2
|
list of str or list of int
|
Column names (DataFrame) or indices (ndarray) for condition 2. |
required |
**overrides
|
Any
|
Override any config field for this call only (cv_thr, p_thr, etc.). |
{}
|
Returns:
| Type | Description |
|---|---|
TestResults
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If cond_1 or cond_2 have fewer than 2 columns, share columns, reference missing columns, or if the data contains non-numeric columns. Also raised for paired analysis with unequal replicate counts or asymmetric missing-value patterns. |
TypeError
|
If data is not a pl.DataFrame or np.ndarray. |
Source code in src/questvar/_api.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | |
compare_all_pairs ¶
Run every pairwise combination from a condition map.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
DataFrame
|
Input data with sample columns. |
required |
condition_map
|
dict of str to list of str
|
Map from condition name to list of column names. |
required |
**overrides
|
Any
|
Override config fields for all comparisons. |
{}
|
Returns:
| Type | Description |
|---|---|
dict of (str, str) to TestResults
|
One TestResults per pair, keyed by (condition_1, condition_2). |
Source code in src/questvar/_api.py
power_analysis ¶
power_analysis(
target_sei=0.8,
eq_boundaries=None,
n_reps_list=None,
cv_mean_list=None,
cv_thr_list=None,
n_prts_list=None,
random_seed=None,
n_prts=10000,
n_iterations=10,
target_power=0.8,
p_thr=0.05,
df_thr=1.0,
cv_thr=1.0,
correction="fdr",
int_mu=18.0,
int_sd=1.0,
cv_k=2.0,
cv_theta=0.5,
n_jobs=None,
)
Run a power analysis sweep. Delegates to run_power_analysis().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target_sei
|
float
|
Target Stable Equivalence Index. Default 0.8. |
0.8
|
eq_boundaries
|
ndarray
|
Equivalence boundaries to sweep. |
None
|
n_reps_list
|
list of int
|
Replicate counts to sweep. |
None
|
cv_mean_list
|
list of float
|
Mean CV values to sweep. |
None
|
cv_thr_list
|
list of float
|
CV thresholds to sweep. |
None
|
n_prts_list
|
list of int
|
Feature counts to sweep. |
None
|
random_seed
|
int
|
Base random seed for deterministic simulation. |
None
|
n_prts
|
int
|
Features per Monte Carlo iteration. Default 10000. |
10000
|
n_iterations
|
int
|
Iterations per design point. Default 10. |
10
|
target_power
|
float
|
Minimum power for design search. Default 0.8. |
0.8
|
p_thr
|
float
|
Adjusted p-value threshold. Default 0.05. |
0.05
|
df_thr
|
float
|
Difference boundary. Default 1.0. |
1.0
|
cv_thr
|
float
|
CV threshold for feature selection. Default 1.0. |
1.0
|
correction
|
str or None
|
Multiple testing correction method. Default "fdr". |
'fdr'
|
int_mu
|
float
|
Mean log-intensity for simulator. Default 18.0. |
18.0
|
int_sd
|
float
|
Log-intensity standard deviation. Default 1.0. |
1.0
|
cv_k
|
float
|
Gamma shape for CV distribution. Default 2.0. |
2.0
|
cv_theta
|
float
|
Gamma scale for CV distribution. Default 0.5. |
0.5
|
n_jobs
|
int
|
Parallel workers. Default uses half of CPU cores. |
None
|
Returns:
| Type | Description |
|---|---|
PowerResults
|
|
Source code in src/questvar/_api.py
348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 | |