The context for this is statistics , so I'll quote Wolfram on tilde in the
context of statistics: http://mathworld.wolfram.com/Tilde.html
"In statistics, the tilde is frequently used to mean "has the distribution
(of)," for instance, X∼N(0,1) means "the stochastic (random) variable X has the
distribution N(0,1) (the standard normal distribution). If X and Y are
stochastic variables then X∼Y means "X has the same distribution as Y."
So X~Y is an assertion of a relationship between X and Y. Sympy has an entire
module filled with these distributions. But maybe it's more useful to say `Z =
Normal('Z', 0, 1)` instead of `Z = Z ~ Normal(0, 1)` or maybe `Z ~= Normal(0,
1)` (Z example from docs, latter tilde examples are mine).
When we say, in R or Patsy, `y ~ x1 + x2`, we are asserting a relationship
between y and the x's. This instantiates a model/formula (in math, usually
written y = x1 + x2 + e) that, given the asserted relationship and some
assumptions, we can use to find the mathematical relationship between the
variables.
I think our biggest concern is, what Guido earlier alluded to here, is, is the
operator precedence correct? In R (and Patsy) the binding is the weakest. In
Python, my first inclination is to make it the strongest so we could coalesce
with the `y` object the other variables. But maybe this is wrong. Maybe it
should be a weak binding. Maybe we can't make it weak because some people think
it should have context in integers where it binds strongly. Maybe Patsy is the
right way to do it. Maybe this is ultimately a bad idea. But I want a record of
the discussion and conclusion, and I want it to be the best reasoned one we can
muster.
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/4H7ARXUVS7COAGWPAH3LDGBXK6GYMHJC/
Code of Conduct: http://python.org/psf/codeofconduct/