# Random Variable

Instance of: measurable function

AKA: random quantity, aleatory variable, or stochastic variable

Distinct from:

English: A variable which takes values from a sample space, where a probablity distribution describes which values/sets of values are more likely to be taken.

Formalization:

A random variable is just a function mapping outcomes to some measurement space. $X:\Omega \mapsto E$

The measurement space is usually the reals, $$\mathbb{R}$$. The outcomes are formally supposed to be probability spaces, which are defined as triples $$(\omega, \mathcal{F}, P)$$. Where $$\mathcal{F}$$ could be sets of more than 1 of the possible outcomes, and $$P$$ maps each possible set to a 0-1 probaility.

$P(X \in S)=P({\omega\in \Omega| X(\omega) \in S})$

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