raw_gen: Raw Data Generation By Log-normal Or Truncated Distribution

Description Usage Arguments Details Value Examples

View source: R/raw_gen.R

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
raw_gen(
  x,
  Trait = 1,
  Pop = 2,
  R.res = NULL,
  dist = c("truncated", "log"),
  lower = -Inf,
  upper = Inf,
  format = c("wide", "long"),
  complete_cases = FALSE
)

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 correlational matrix, Default: NULL

dist

univariate distribution used for data generation either 'log' for log normal or ‘truncated' for truncated distribution, Default: ’truncated'

lower

vector of lower bounds, Default: -Inf

upper

vector of upper bounds, Default: Inf

format

form of the resultant data frame either 'long' or 'wide', Default: 'wide'

complete_cases

Logical; if TRUE rows with missing values will be removed, 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 correlational 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 correlational matrix as in baboon.parms_R. If data frame is entered without a correlational matrix, data generation is carried out using univariate distribution. N.B: Transformation of raw summary data to logged data is only possible for univariate distribution and if multivariate log normal distribution is desired logged values should be entered directly with 'dist' set to 'truncated'.

Value

a data frame of raw data

Examples

1
2
3
4
5
6
# Data generation using univariate distribution
library(TestDimorph)
raw_gen(baboon.parms_df)
# Data generation using multivariate distribution
library(TestDimorph)
raw_gen(baboon.parms_list)

bassam-abulnoor/TestDimorph documentation built on Jan. 29, 2021, 8:21 a.m.