question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for log-transforms (and other arithmetic) in formula?

See original GitHub issue

Hi all,

I’m a big fan of bambi, thanks for all your great work!

I have a question about more complicated formulas. I’m currently trying to fit models taken from a textbook. One of the formula strings used there is:

log(weight) ~ log(I(diam1 * diam2 * canopy_height)) + log(I(diam1 * diam2)) + log(I(diam1 / diam2)) + log(total_height) + group

In other words, it includes log transformations, and also some other arithmetic operations. What I’m curious about is whether bambi supports this in some way, or whether all such transformations should be done beforehand, e.g. by creating a variable log_total_height = np.log(total_height)?

Thanks for your help!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
aflaxmancommented, Feb 21, 2022

You can also perhaps save the annoyance of defining your own log by importing it explicitly instead with from numpy import log — very cool stuff!

1reaction
martiningramcommented, Feb 21, 2022

Terrific, thanks Tomas! This is working very well, so I am closing this issue!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Calculation operators and precedence in Excel
There are four different types of calculation operators: arithmetic, comparison, text concatenation, and reference. Arithmetic operators.
Read more >
When (and why) should you take the log of a distribution (of ...
Is it not always true that the second moment and the variance are proportional to one another? We have the classic equation saying:...
Read more >
Log-transformation and its implications for data analysis - PMC
The log-transformation is widely used in biomedical and psychosocial research to deal with skewed data. This paper highlights serious problems in this ...
Read more >
You should (usually) log transform your positive data
The log transformation is particularly relevant when the data vary a lot on the relative scale. Increasing prices by 2% has a much...
Read more >
Calculate values using data in table cells in Numbers on Mac
Type an arithmetic operator (for example, +, -, *, or /), then select another cell to use in your formula, or type a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found