Type: Package
Title: Simulated Grouped Hyper Data Frame
Version: 0.2.0
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
Depends: R (≥ 4.5), groupedHyperframe (≥ 0.3.0)
Imports: cli, MASS, spatstat.geom, spatstat.random
Suggests: knitr, quarto, rmarkdown, magrittr
VignetteBuilder: quarto
NeedsCompilation: no
Packaged: 2025-10-14 01:36:27 UTC; tingtingzhan
Author: Tingting Zhan ORCID iD [aut, cre], Inna Chervoneva ORCID iD [aut]
Maintainer: Tingting Zhan <tingtingzhan@gmail.com>
Repository: CRAN
Date/Publication: 2025-10-14 10:40:07 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.

Note

Help files of individual functions are intentionally suppressed in the pdf manual. Users are encouraged to get started with

vignette('intro', package = 'groupedHyperframe.random')

Author(s)

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

Authors:

See Also

Useful links:


Simulate (Marked) Point Pattern

Description

To generate ppp.object(s), 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

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 function ls).


Simulate groupedHyperframe

Description

Simulate groupedHyperframe

Usage

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

Arguments

...

see examples, for now

n

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

win

owin.object

envir

environment

Value

Function grouped_rppp() returns a groupedHyperframe.


Expand Types of Sigma in mvrnorm

Description

To accommodate more types of Sigma in function mvrnorm.

Usage

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

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

...

additional parameter of 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

Function mvrnorm2() returns a double matrix.

Note

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


Generate Random factor

Description

..

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

Function rfactor() is a wrapper of sample.int.

Value

Function rfactor() returns a factor.

Note

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])