# Probability Mass/Density Function (PMF/PDF)

Instance of: function

AKA: Discrete density function; density; Probability Function

Distinct from:

English: A function that takes in a value, and returns the relative likelihood that a random variable takes on that value. Probability mass functions refer to discrete distributions, e.g. what is the probability that a 6 sided die lands on 5? Probability density functions refer to continuous probability distributions and are usually discussed in terms of ranges or cut ponts, e.g., what is the probability that a sample from a random normal value is above 2?

Formalization:

In the continous case, the probability that a random variable $$X$$ takes on a value between $$a$$ and $$b$$ is the integration of its density over that range. $Pr[a \le X \le b]= \int_{a}^{b} f_x(x)dx$

Where $$a$$ and $$b$$ are the range of values, and $$f_x$$ is the density of the random variable.

Cites: Wikipedia ; Wikidata ; Wolfram

Code

Examples:

Examples:

library(DBI)
# Create an ephemeral in-memory RSQLite database
#con <- dbConnect(RSQLite::SQLite(), dbname = ":memory:")
#dbListTables(con)
#dbWriteTable(con, "mtcars", mtcars)
#dbListTables(con)

require(RPostgres)
Loading required package: RPostgres
# Connect to the default postgres database
con <- dbConnect(RPostgres::Postgres())
import torch