Learn R Programming

TestDimorph (version 0.5.7)

raw_gen: Raw Data Generation By Normal Or Truncated Normal Distribution

Description

Generates raw data from summary statistics using uni/multivariate truncated normal distribution

Usage

raw_gen(
  x,
  Trait = 1,
  Pop = 2,
  R.res = NULL,
  lower = -Inf,
  upper = Inf,
  verbose = FALSE
)

Value

a data frame of raw data

Arguments

x

Data frame or list containing summary statistics for multiple parameters measured in both sexes in two or more populations.

Trait

Number of the column containing names of measured parameters, Default: 1

Pop

Number of the column containing populations' names, Default: 2

R.res

Pooled within correlation matrix, Default: NULL

lower

scalar of lower bounds, Default: -Inf

upper

scalar of upper bounds, Default: Inf

verbose

Logical; if TRUE displays a message with the method used for generation , Default: FALSE

Details

If data generation is desired using multivariate distribution data is entered in the form of a list of summary statistics and pooled within correlation matrix as in baboon.parms_list, or the summary statistics are entered separately in the form of a data frame as in baboon.parms_df with a separate correlation matrix as in baboon.parms_R. If data frame is entered without a correlation matrix, data generation is carried out using univariate distribution.

Examples

Run this code
# Data generation using univariate distributions
raw_gen(baboon.parms_df, lower = 0)

# another univariate example
library(dplyr)
data <- Cremains_measurements[1, ] %>% mutate(Pop=c("A")) %>%
relocate(Pop,.after=1)
raw_gen(data)[, -2]

# Data generation using multivariate distribution
raw_gen(baboon.parms_list, lower = 0)

Run the code above in your browser using DataLab