Skip to content

Commit

Permalink
typealiases for R names
Browse files Browse the repository at this point in the history
  • Loading branch information
kleinschmidt committed Jul 31, 2016
1 parent a20f290 commit a2e3ff5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/DataFrames.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ export @~,
ModelMatrix,
SubDataFrame,
EffectsCoding,
SumCoding,
DummyCoding,
TreatmentCoding,
HelmertCoding,
ContrastsCoding,

Expand Down
15 changes: 15 additions & 0 deletions src/statsmodels/contrasts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,14 @@ Also known as "treatment coding" (`contr.treatment` in R) or "one-hot encoding".
"""
DummyCoding

"""
TreatmentCoding([base[, levels]])
Alias for `DummyCoding`, which is also known as treatment coding (e.g.,
`contr.treatment` in R).
"""
typealias TreatmentCoding DummyCoding

contrasts_matrix(C::DummyCoding, baseind, n) = eye(n)[:, [1:(baseind-1); (baseind+1):n]]


Expand All @@ -249,6 +257,13 @@ schemes.
"""
EffectsCoding

"""
SumCoding([base[, levels]])
Alias for `EffectsCoding`, which is also known as sum coding (e.g., `contr.sum` in R).
"""
typealias SumCoding EffectsCoding

function contrasts_matrix(C::EffectsCoding, baseind, n)
not_base = [1:(baseind-1); (baseind+1):n]
mat = eye(n)[:, not_base]
Expand Down

0 comments on commit a2e3ff5

Please sign in to comment.