pars_rand: Randomly generate a set of 'feasible' parameter sets...

Description Usage Arguments Author(s) Examples

View source: R/processing.R

Description

Randomly generate a set of 'feasible' parameter sets describing distribution of Z_a and Z_d, used for initiating E-M algorithm. pi2 is drawn such that log10(pi2) has a uniform distribution with max. value 5, min. value 1. Values of pi2>0.1 are not expected, and 10^-5 is a low enough prior to initialise the EM algorithm if the true value is smaller than this. pi1 is drawn from either U(0.3,0.7) or such that log10(pi1)~U(1,3), the first with probability p_reg sigma_1 and tau are either 1 or drawn such that sigma_1^2~U(1,10) sigma_2 is either 1 or drawn such that sigma_1^2~U(1,10) rho is either 0 or U(0.05,0.95)*sigma_2*tau

Usage

1
pars_rand(N = 1000, H = 1, p_reg = 0.3, seed = NULL)

Arguments

N

number to generate

H

hypothesis; 0 or 1. Under H=0, sigma2 is forced to 1 and rho to 0.

p_reg

probability that pi1 is U(0.3,0.7), sigma_1=1, sigma_2=1, tau=1, rho=0

seed

random seed for generating results; use to regenerate.

Author(s)

James Liley

Examples

1
2
3
4
5
6
7
8
9
px=pars_rand()
par(mfrow=c(2,3))
plot(density(px[,2],from=0,to=1),main="pi1") # distribution of pi1
plot(density(log10(1-px[,1]-px[,2]),from=-5,to=-1),main="log10(pi2)") # empirical distribution of log10(pi2)
plot(density(px[,3]),main="tau") # empirical density of tau
plot(density(px[,4]),main="sigma1") # empirical density of sigma1
plot(density(px[,5]),main="sigma2") # empirical density of sigma2
plot(density(px[,6],from=0),main="rho") # empirical density of rho
par(mfrow=c(1,1))

jamesliley/subtest documentation built on May 18, 2019, 11:21 a.m.