exdata | R Documentation |
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.
exdata(x, id, idmat, nmy = 4)
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. |
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.
a data frame including extended x(age) and the corresponding id.
Zhiqiang Cao zcaoae@connect.ust.hk, L.L. Huihuic@cuhk.edu.hk and M.Y. Wong mamywong@ust.hk
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.