simwtage: Simulate Weight Age Pairs.

Description Usage Arguments Value Examples

View source: R/simulationGAMLSS.R

Description

Simulate Weight Age Pairs.

Usage

1
2
3
4
5
simwtage(gamlssbcpemodel, optimizedparameters, modeldata,
  indexofparameterfortransformedage = NULL, startageyears = 0,
  endageyears = 2, stepageincrease = 1/12, nweightsperage = 500,
  sex = "boys", exclusionthresholdup = 0.97,
  exclusionthresholddown = 0.03, seed = 456784112)

Arguments

gamlssbcpemodel

A fitted gamlss BCPE model object.

optimizedparameters

A vector of hyper parameters used to inform the fitting of the object.

modeldata

The data used to fit the gamlss model. It is needed for the gamlss prediction function.

indexofparameterfortransformedage

If applicable the index of the parameter in the optimizedparameters vector that refers to the power of age.

startageyears

The starting age at which simulation starts in years. Default is 0 years.

endageyears

The ending age at which simulation ends in years. Default is 2 years.

stepageincrease

The step in years at which we increment from startageyears to endageyears. Default is 1 year.

nweightsperage

The number of simulated weights for each unique age.

sex

A string to add to the generated data.

exclusionthresholdup

The percentile that determines at which upper percentile we exlude simulated weights. Default to 0.03 (third percentile).

exclusionthresholddown

The percentile that determines at which lower percentile we exlude simulated weights. Default to 0.97 (ninety seventh percentile).

seed

A seed number to ensure reproducibility

Value

The simulated data with age in years and weight in kg and the sepcified sex character string.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
require(gamlss)
require(tidyr)
require(nhanesgamlss)

mBOYS20 <- gamlss(WT ~ cs(nage, df = op120$par[1]),
sigma.fo = ~cs(nage,df = op120$par[2]),
nu.fo = ~cs(nage, df =  op120$par[3] ),
c.spar = c(-1.5,2.5),
tau.fo = ~cs(nage, df = op120$par[4]),
data = BMXBOY20, family = BCPE)

simwtage(gamlssbcpemodel = mBOYS20, optimizedparameters = op120, modeldata = BMXBOY20,
indexofparameterfortransformedage = 5, startageyears = 0, endageyears = 18,
stepageincrease = 1, nweightsperage = 500, sex = "boys", exclusionthresholdup = 0.97,
exclusionthresholddown = 0.03, seed = 456784112)

mGIRLS20 <- gamlss(WT ~ cs(nage, df = op2200$par[1]),
sigma.fo = ~cs(nage,df = op2200$par[2]),
nu.fo = ~cs(nage, df =  op2200$par[3] ),
c.spar = c(-1.5,2.5),
tau.fo = ~cs(nage, df = op2200$par[4]),
data = BMXGIRL20, family = BCPE)

simwtage(gamlssbcpemodel = mGIRLS20, optimizedparameters = op2200, modeldata = BMXGIRL20,
indexofparameterfortransformedage = 5, startageyears = 0, endageyears = 18,
stepageincrease = 1, nweightsperage = 500, sex = "girls", exclusionthresholdup = 0.97,
exclusionthresholddown = 0.03, seed = 456784112)

smouksassi/nhanesgamlss documentation built on Feb. 11, 2020, 10:21 p.m.