Skip to content

Commit

Permalink
Update formula.jl to include asinh (#67)
Browse files Browse the repository at this point in the history
* Update formula.jl to include asinh

asinh transformation is parallel in R and Julia, so can treat it like exp and log transformations

* Add asinh transformation test

* Bump Version to 1.1.0
  • Loading branch information
Tristan-Siegfried committed Jun 23, 2023
1 parent 24ef721 commit 5066a51
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "JellyMe4"
uuid = "19ac8677-9a15-4623-9afd-84acc6165ce7"
authors = ["Phillip Alday <me@phillipalday.com>"]
version = "1.0.1"
version = "1.1.0"

[deps]
CategoricalArrays = "324d7699-5711-5eae-9e2f-1d82baa6b597"
Expand Down
1 change: 1 addition & 0 deletions src/formula.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ function convert_julia_to_r(f::StatsModels.FormulaTerm)::AbstractString

formula = replace(formula, ":(log" => "(log")
formula = replace(formula, ":(exp" => "(exp")
formula = replace(formula, ":(asinh" => "(asinh")
# should we consider supporting division on the lhs?
# what about nesting syntax on the rhs?
# zscore won't work here because the operations within a formula are broadcast
Expand Down
11 changes: 11 additions & 0 deletions test/glmerMod.jl
Original file line number Diff line number Diff line change
Expand Up @@ -235,5 +235,16 @@ logistic(x) = 1 / (1 + exp(-x))
@rput jm
@test fixef(jlmm) rcopy(R"fixef(jm)")
end
@testset "asinh transformation" begin
dat = dataset(:verbagg)

jlmm = fit(MixedModel,
@formula(r2 ~ 1 + asinh(anger) + gender + btype + situ + (1 | subj) +
(1 | item)),
dat, Bernoulli())
jm = (jlmm, dat)
@rput jm
@test fixef(jlmm) rcopy(R"fixef(jm)")
end
end
end

2 comments on commit 5066a51

@palday
Copy link
Owner

@palday palday commented on 5066a51 Jun 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/86106

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v1.1.0 -m "<description of version>" 5066a516e2a02f810f9a216ab15ae701e10dfe3a
git push origin v1.1.0

Please sign in to comment.