Skip to content

Commit

Permalink
Merge pull request #292 from CliMA/Bessel-corrected-std
Browse files Browse the repository at this point in the history
Bessel-corrected std in ZScore transformation
  • Loading branch information
glwagner committed Jan 12, 2023
2 parents ccef976 + 22c54d5 commit 3f56069
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Transformations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ function ZScore(data)

data = dropdims(data, dims=1)
μ = mean(data)
σ = std(data; corrected=false)
σ = std(data; corrected=true)

if σ == 0
@warn "Your data has zero variance --- just sayin'! I'm setting ZScore σ = 1."
Expand Down
2 changes: 1 addition & 1 deletion test/test_transformations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ using Statistics
sliced_raw_observations = reshape(sliced_raw_observations, (ny * nz, 1))

# normalize
μ, σ = mean(sliced_raw_observations), sqrt(cov(sliced_raw_observations; corrected=false))
μ, σ = mean(sliced_raw_observations), sqrt(cov(sliced_raw_observations; corrected=true))
@. sliced_raw_observations = (sliced_raw_observations - μ) / σ

@test parent(observation_map(map, observations)) parent(sliced_raw_observations)
Expand Down

0 comments on commit 3f56069

Please sign in to comment.