random.functions {kyotil}R Documentation

Random Functions

Description

Generate samples from random variables.

Usage


dbern(x, prob, log = FALSE)

dcorbern(x, p, a, log = FALSE)

dmixnorm(x, mix.p, sd1, sd2, log = FALSE)

dnorm.norm.gamma(x, p, same.distr = FALSE, log = FALSE)

rbern(n, prob, generalized = FALSE)

rbigamma(n, shape.1, shape.2, rate.1, rate.2, rho)

rbilogistic(n, loc.1, loc.2, scale.1, scale.2, rho) 

rejective.sampling(N, n, pik)

rnorm.ar(n, sd, rho)

rnorm.norm.gamma(n, mu.0, lambda, alpha, beta)

rmixnorm (n, mix.p, mu1, mu2, sd1, sd2)

rdoublexp(n, location=0, scale=1) 
ddoublexp(x, location=0, scale=1) 
qdoublexp(p, location=0, scale=1) 
pdoublexp(q, location=0, scale=1) 

rbidoublexp(n, loc.1, loc.2, scale.1, scale.2, rho) 

Arguments

q

tbdx

location

tbdx

scale

tbdx

x

tbdx

prob

tbdprob

log

tbdlog

p

tbdp

a

tbda

mix.p

tbdmix.p

sd1

tbdsd1

sd2

tbdsd2

same.distr

tbdsame.distr

n

tbdn

generalized

tbdgeneralized

N

tbdN

pik

tbdpik

mu

tbdmu

mu1

tbdmu

mu2

tbdmu

sd

tbdsd

alpha

tbdalpha

mu.0

tbdmu.0

lambda

tbdlambda

beta

tbdbeta

loc.1

tbdbeta

loc.2

tbdbeta

scale.1

tbdbeta

scale.2

tbdbeta

rate.1

tbdbeta

rate.2

tbdbeta

shape.1

tbdbeta

shape.2

tbdbeta

rho

tbdbeta

Details

rbern generates Bernoulli random variables.
rbilogistic generates a bivariate logistic distribution for correlation coefficient 0.5, or [-0.271, 0.478].
In the former case it is generated by calling rbilogis, part of the VGAM package; in the latter case it is generated via the AMH copular.
rnorm.ar simulate autoregressive normal random variables, correlation is rho^d between x_1 and x_(1+d)

Examples


set.seed(1)
rbern(n=10, p=1/2)
rbern(n=2, p=c(.999,.001))

## Not run: 
tmp=replicate(1e4, rnorm.cor(10, 1, .81))
round(cor(t(tmp)),2)

## End(Not run)

[Package kyotil version 2024.5-8 Index]