Type: Package
Title: Simulated Grouped Hyper Data Frame
Version: 0.2.3
Description: An intuitive interface to simulate (1) superimposed (marked) point patterns with vectorized parameterization of random point pattern and distribution of marks; and (2) grouped hyper data frame based on population parameters and subject-specific random effects.
RoxygenNote: 7.3.3
Encoding: UTF-8
License: GPL-2
Language: en-US
URL: https://github.com/tingtingzhan/groupedHyperframe.random, https://tingtingzhan.quarto.pub/groupedhyperframe/random, https://tingtingzhan-groupedhyperframe.netlify.app/random
Depends: R (≥ 4.5), groupedHyperframe (≥ 0.3.0)
Imports: cli, MASS, spatstat.geom, spatstat.random
NeedsCompilation: no
Packaged: 2026-03-02 15:34:33 UTC; tingtingzhan
Author: Tingting Zhan ORCID iD [aut, cre]
Maintainer: Tingting Zhan <tingtingzhan@gmail.com>
Repository: CRAN
Date/Publication: 2026-03-02 16:10:02 UTC

groupedHyperframe.random: Simulated Grouped Hyper Data Frame

Description

An intuitive interface to simulate (1) superimposed (marked) point patterns with vectorized parameterization of random point pattern and distribution of marks; and (2) grouped hyper data frame based on population parameters and subject-specific random effects.

Author(s)

Maintainer: Tingting Zhan tingtingzhan@gmail.com (ORCID)

See Also

Useful links:


Simulate (Marked) Point Pattern

Description

To simulate ppp.object, with none or one or multiple marks.

Usage

.rppp(
  ...,
  dots,
  win = square(),
  n = 1L,
  element1 = TRUE,
  envir = parent.frame()
)

Arguments

...

see vignettes

dots

(for internal use) list of one or more named lists. The first list specifies the parameters to generate the x- and y-coords. The second to last lists, if available, specify the parameters to generate one or more marks.

win

owin.object

n

integer scalar, number of ppp.objects to generate. Default 1L.

element1

logical scalar, whether to return a ppp.object, instead of a length-1L solist, when n==1L. Default TRUE

envir

environment, in which to evaluate the ... dyn-dots argument. Default is the parent.frame.

Value

The function .rppp() returns a ppp.object if (n==1L)&element1, otherwise returns a length-n solist (which also has class 'ppplist').

The returned ppp.object(s) contain only x- and y-coords, if only one call is present in the ... dyn-dots argument. Otherwise, they contain one or more marks according to the rest of the call(s) in the ... argument.

Note

The name rppp() is too aggressive, which might be claimed in future by package spatstat.random. Therefore we name this function .rppp() as if it is hidden (see parameter all.names of the function ls).

References

https://tingtingzhan.quarto.pub/groupedhyperframe/nonS3/rppp.html


Simulate groupedHyperframe with One-and-Only-One ppp-Hypercolumn

Description

To simulate a groupedHyperframe with one-and-only-one ppp-hypercolumn.

Usage

grouped_rppp(..., n, win = square(), envir = parent.frame())

Arguments

...

see examples in the vignette, for now

n

integer vector, numbers of ppp.objects to generate for each set of parameters

win

owin.object

envir

environment

Value

The function grouped_rppp() returns a groupedHyperframe.

References

https://tingtingzhan.quarto.pub/groupedhyperframe/nonS3/grouped_rppp_appx.html


Expand Types of Sigma in mvrnorm

Description

To accommodate more types of Sigma in the function mvrnorm.

Usage

mvrnorm2(
  n,
  mu,
  sd,
  Sigma = diag(x = sd^2, nrow = d, ncol = d),
  row.prefix,
  col.prefix,
  ...
)

Arguments

n

integer scalar, sample size

mu

numeric scalar or vector, multivariate means \mathbf{\mu}'s

sd

numeric scalar or a vector, standard deviation(s)

Sigma

numeric variance-covariance matrix, see function mvrnorm

row.prefix, col.prefix

(optional) character scalars

...

additional parameter of the function mvrnorm

Details

Argument of parameter sd could be

scalar

sd is recycled to the length of mu

vector

check that length of sd and mu must be the same

Then a diagonal matrix with vector sd^2 on the diagonal elements is used as the variance-covariance matrix \Sigma

Value

The function mvrnorm2() returns a double matrix.

Note

The workhorse function mvrnorm from package MASS is faster than ?mvtnorm::rmvnorm.

References

https://tingtingzhan.quarto.pub/groupedhyperframe/nonS3/mvrnorm2.html


Generate Random factor

Description

To generate random factor.

Usage

rfactor(n, prob, levels = as.character(seq_len(nprob)))

Arguments

n

integer scalar

prob

numeric vector, see function sample.int

levels

character vector, see function factor

Details

The function rfactor() is a wrapper of sample.int.

Value

The function rfactor() returns a factor.

Note

The function rmultinom is not what we need!

Examples

rfactor(n = 100L, prob = c(4,2,3))
rfactor(n = 100L, prob = c(4,2,3), levels = letters[1:3])