rHRM: Generates random sample

View source: R/gr_rHRM.R

rHRMR Documentation

Generates random sample

Description

If the method is called on object of class HRMtree it generates a random sample from a Markov tree whose every two adjacent nodes are parameterized with a bivariate Huesler-Reiss distribution with parameter the weight associated to the edge connecting the two variables. Markov tree means that the random vector satisfies the global Markov property. See Vignette "Additional functionalities" for further explanation of the distribution from which it is sampled. If the method is called on an object of class HRMBG then it generates a random sample from a Huesler-Reiss distribution with structured parameter matrix. See Vignette "Additional functionalities" for further explanation of the distribution from which it is sampled. See Vignette "Huesler-Reiss distributions" for the parameterization on block graphs.

Usage

rHRM(obj, ...)

## S3 method for class 'HRMnetwork'
rHRM(obj, n, noise = FALSE, ...)

## S3 method for class 'HRMBG'
rHRM(obj, lambda, n, noise = FALSE, ...)

Arguments

obj

Object of class HRMnetwork or its subclasses such as HRMtree and HRMBG or subclasses of these two. If no explicit method exists the method rHRM.HRMnetwork is called.

...

additional arguments

n

The size of the sample

noise

TRUE/FALSE indicates whether to include (TRUE) a standard normal noise to all observations in the sample. The default is FALSE.

lambda

is a structured parameter matrix of the Huesler-Reiss distribution. See Vignette "Huesler-Reiss distributions" parameterization on block graphs.

Value

A matrix with the generated observations.

Examples

# create a graph with named vertices
g<- graph(c("a", "b", "b","c", "b", "d"), directed = FALSE)
# create a HRMtree object
myobj<- HRMtree(g)
x<- c(0.1,0.2,0.3)
myobj<- setParams(myobj, x)
# create a dataset
mydata<- rHRM(myobj, 1000)
mydata_noisy<- rHRM(myobj, 1000, noise=TRUE)

gremes documentation built on Feb. 16, 2023, 8:06 p.m.