openavmkit.ratio_study
IAAO-standard ratio studies.
Implements :class:RatioStudy and :class:RatioStudyBootstrapped, which
compute the standard ratio-study statistics used in mass appraisal:
- Median and mean ratio (predicted / observed sale price)
- COD (Coefficient of Dispersion) — overall variability
- PRD (Price-Related Differential) — vertical equity proxy
- PRB (Price-Related Bias) — alternative vertical equity measure
Each statistic is also produced in a "trimmed" form that excludes outlier
ratios beyond the interquartile range, capped by
analysis.ratio_study.trim.<model_group>.max_percent (default 10%).
See the :doc:/advanced_settings page for relevant settings (look-back
years, trim caps).
RatioStudy
RatioStudy(predictions, ground_truth, max_trim)
Performs an IAAO-standard Ratio Study, generating all the relevant statistics.
Attributes:
| Name | Type | Description |
|---|---|---|
predictions |
ndarray
|
Series representing predicted values |
ground_truth |
ndarray
|
Series representing ground truth values (typically observed sale prices) |
count |
int
|
The number of observations |
median_ratio |
float
|
The median value of all |
mean_ratio |
float
|
The mean value of all |
cod |
float
|
The coefficient of dispersion, a measure of variability (lower is better) |
cod_trim |
float
|
The coefficient of dispersion, after outlier ratios outside the interquartile range have been trimmed |
prd |
float
|
The price-related differential, a measure of vertical equity |
prb |
float
|
The price-related bias, a measure of vertical equity |
Initialize a ratio study object
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
predictions
|
ndarray
|
Series representing predicted values |
required |
ground_truth
|
ndarray
|
Series representing ground truth values (typically observed sale prices) |
required |
max_trim
|
float
|
The maximum amount of records allowed to be trimmed in a ratio study |
required |
Source code in openavmkit/ratio_study.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | |
RatioStudyBootstrapped
RatioStudyBootstrapped(predictions, ground_truth, max_trim, confidence_interval=0.95, iterations=1000)
Performs an IAAO-standard Ratio Study, generating all the relevant statistics. This version adds confidence intervals.
Attributes:
| Name | Type | Description |
|---|---|---|
iterations |
float
|
Number of bootstrap iterations |
confidence_interval |
float
|
The confidence interval (e.g. 0.95 for 95% confidence) |
median_ratio |
ConfidenceStat
|
The median value of all |
mean_ratio |
ConfidenceStat
|
The mean value of all |
cod |
ConfidenceStat
|
The coefficient of dispersion, a measure of variability (lower is better) |
prd |
ConfidenceStat
|
The price-related differential, a measure of vertical equity |
median_ratio_trim |
ConfidenceStat
|
The median value of trimmed |
mean_ratio_trim |
ConfidenceStat
|
The mean value of trimmed |
cod_trim |
ConfidenceStat
|
The coefficient of dispersion, a measure of variability (lower is better), of the trimmed set |
prd_trim |
ConfidenceStat
|
The price-related differential, a measure of vertical equity, of the trimmed set |
Initialize a Bootstrapped ratio study object
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
predictions
|
ndarray
|
Series representing predicted values |
required |
ground_truth
|
ndarray
|
Series representing ground truth values (typically observed sale prices) |
required |
max_trim
|
float
|
The maximum amount of records allowed to be trimmed in a ratio study |
required |
confidence_interval
|
float
|
Desired confidence interval (default is 0.95, indicating 95% confidence) |
0.95
|
iterations
|
int
|
How many bootstrap iterations to perform |
1000
|
Source code in openavmkit/ratio_study.py
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 | |
run_and_write_ratio_study_breakdowns
run_and_write_ratio_study_breakdowns(settings)
Runs ratio studies, with breakdowns, and writes them to disk.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
settings
|
dict
|
Settings dictionary |
required |
Source code in openavmkit/ratio_study.py
324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | |