exdata: Perform interpolation for original time measurements.

View source: R/exdata.R

exdataR Documentation

Perform interpolation for original time measurements.

Description

This function evenly partitions time measurements and produces additional ones for an individual in his/her age range. It then uses predict.sitar to obtain additional fitted values to calculate apv, pv and ypv.

Usage

exdata(x, id, idmat, nmy = 4)

Arguments

x

vector of ages.

id

factor of subject identifiers.

idmat

matrix of unique id (note that the dimension of this matrix should be n*1).

nmy

number of measurements in a year produced by interpolation through original data. Default value is 4, which means in the interpoaltion data, each individual has 4 measurements in a year over range of age measurements. If nmy=365, which means in the interpolation data, every individual has 365 measurements in a year.

Details

For some individuals, the number of measurements is small. In order to calculate accurate apv (age at peak velocity), pv (peak velocity) and ypv (height at peak velocity or weight at peak velocity), it is necessary to perform interpolation for original time measurements and obtain additional predictions for each individual. To calculate apv using the numerical method, nmy should be large, so set nmy=365. This ensures that each individual has 365 measurements every year. To calculate apv using the property of the quadratic function, set nmy=4. This ensures that all individuals have 4 measurements each in a year. Note that output of this function occupies two columns, that is, the ‘x’ column and the ‘id’ column.

Value

a data frame including extended x(age) and the corresponding id.

Author(s)

Zhiqiang Cao zcaoae@connect.ust.hk, L.L. Huihuic@cuhk.edu.hk and M.Y. Wong mamywong@ust.hk

Examples

require(sitar)
x <- heights$age
id <- heights$id
idmat <- matrix(unique(id), ncol = 1)
###extending original frequency to 4 measurements a year
newdata1 <- exdata(x, id, idmat)
###extending original frequency to 12 measurements a year
newdata2 <- exdata(x, id, idmat, nmy=12)

Zhiqiangcao/iapvbs documentation built on March 12, 2024, 10:55 p.m.