Learn R Programming

clttools (version 1.3)

expt: Theoretical Probability Distribution of General Experiment

Description

General experiment with basic probability

Usage

expt(x, n, prob = NULL)

Arguments

x
vector, possible outcomes in one trial of experiment
n
number of trials
prob
probability assigned to each possible outcome

Value

Mean value and corresponding probabilities for all possible outcomes.

Details

The default probabilty equals to 1/n. All the assigned probabilites must between 0 and 1.

Examples

Run this code
expt(x = c(1:3), n = 4)
expt(c(2:4), 3, prob = c(0.3, 0.5, 0.2))

Run the code above in your browser using DataLab