Showing 185 to 188

Joint probability distribution

#statistics

Given random variables X,Y,…, a JPD is the distribution that gives the probability that each of X,Y,… fall in any particular range. In the case of only two random variables, this is called a bivariate distribution, which can be visualized three-dimensionally; with more, it is a multivariate distribution.

Much like any probability distribution, the input is a sample space and the output is a probability, and it can be expressed either in terms of a joint PDF or a joint CDF. These can in turn be used to find the marginal distribution for any specific variable, and the conditional distribution giving the probs for any subset of the variables conditional on particular values of the remaining variables.

What links here

Created (3 years ago)

Power law vs exponential

#statistics

  • Exponential: (constant)x
  • Power law: x(constant)

Power law distributions are fractal. Twice as wealthy is half as likely, or whatever the constant you use.

Exponentials decay faster than power laws. In an exponential based on 0.5x, every increase of x by one point halves the probability, whereas in a power law based on x0.5, you need greater increases of x to halve the probability. Pareto distributions in particular have a property called . . .

The Pareto distribution is related to the exponential distribution as follows. If X is Pareto-distributed with minimum xm and index α, then

Y=log(Xxm) {\displaystyle Y=\log \left({\frac {X}{x_{\mathrm {m} }}}\right)}

is exponentially distributed with rate parameter α. Equivalently, if Y is exponentially distributed with rate α, then

xmeY x_\mathrm{m} e^Y

is Pareto-distributed with minimum xm and index α.

This can be shown using the standard change-of-variable techniques:

Pr(Y<y)=Pr(log(Xxm)<y)=Pr(X<xmey)=1(xmxmey)α=1eαy.\begin{align*} \Pr(Y<y)&=\Pr \left(\log \left({\frac {X}{x_{\mathrm {m} }}}\right)<y\right)\\&=\Pr(X<x_{\mathrm {m} }e^{y})=1-\left({\frac {x_{\mathrm {m} }}{x_{\mathrm {m} }e^{y}}}\right)^{\alpha }=1-e^{-\alpha y}. \end{align*}

The last expression is the cumulative distribution function of an exponential distribution with rate α.

Created (3 years ago)

Eshell/shell

#emacs Cheatsheets/TILs

Pressing RET anywhere executes that line. For example, when Guix tells you to reload GUIX_PROFILE, it prints out the commands to do so. So you can simply… go there with the cursor and press RET! It's so stupid yet so good.

Cool hotkeys

  • C-c C-p -> return to top of last command
  • C-c M-b inserts the printed buffer name at point
  • C-c M-i inserts the printed process name at point
  • C-c M-v inserts an env var at point
  • C-c M-d toggles betw direct input and delayed input (send on RET) (useful for some programs) (<2020-Apr-23>: is this basically for y/n prompts?)
(defun eshell-here ()
  "Opens up a new shell in the directory associated with the
current buffer's file. The eshell is renamed to match that
directory to make multiple eshell windows easier."
  (interactive)
  (let* ((parent (if (buffer-file-name)
                     (file-name-directory (buffer-file-name))
                   default-directory))
         (height (/ (window-total-height) 3))
         (name   (car (last (split-string parent "/" t)))))
    (split-window-vertically (- height))
    (other-window 1)
    (eshell "new")
    (rename-buffer (concat "*eshell: " name "*"))

    (insert (concat "ls"))
    (eshell-send-input)))

;;  My function, x exits that shell and closes that window.
(defun eshell/x ()
  (insert "exit")
  (eshell-send-input)
  (delete-window))

Programs like top wouldn’t work well in Eshell […] However, if you type top, eshell notices top on its naughty list (the list is called eshell-visual-commands), and will farm it out to a special comint buffer. If you find an app that doesn’t work well in EShell, append it to this list.

It is not bash or zsh or even csh; do not treat it as such, even though it is heavily inspired by them. To use Eshell effectively you should treat it as if you are using a completely alien shell.

–Howard Abrams

Argument predicates are a cool way of quickly filtering lists of files or even elisp lists. The predicate syntax is based on the one used in zsh, so if you are familiar with argument predication in zsh, you can apply most of your knowledge to Eshells’ version.

Unlike most other areas of Eshell, argument predicates are documented in Eshell itself. You can access the help files by typing eshell-display-predicate-help or eshell-display-modifier-help (directly in eshell of course).

Filtering globbed lists of files is very useful, as it saves you the hassle of using tools like find or abusing ls to do your thing.

What links here

Created (3 years ago)

Likelihood function

#statistics

The likelihood measures the goodness of fit of a model to a sample of data, for given values of the unknown parameters.

It is formed from the Joint probability distribution of the sample, but viewed and used as a function of the parameters only, treating the random variables as fixed at the observed values (like in Bayes?).

What links here

Created (3 years ago)
Showing 185 to 188