plotvel: Plot individual velocities obtained from the numerical and...

View source: R/plotvel.R

plotvelR Documentation

Plot individual velocities obtained from the numerical and the quadratic function method

Description

After fitting the SITAR model, this function plots velocities computed from the numerical method and the quadratic function method. Through velocity comparison, the function can determine whether the individual's growth curve is fitted well or not by the SITAR model.

Usage

plotvel(object, candid, nmy1 = 365, nmy2 = 12, xfun = NULL, yfun = NULL)

Arguments

object

an object inheriting from class sitar.

candid

a candidate id, which is the id of the individual your want to see his (or her) velocities obtained from the numerical and the quadratic function method.

nmy1

number of measurements in a year produced by interpolation through original data. Default value is 365, this parameter is used for the numerical method.

nmy2

number of measurements in a year produced by interpolation through original data. Default value is 12, this parameter is used for the quadratic function method.

xfun

an optional function to apply to x to convert it back to the original scale, e.g. if x = log(age) then xfun = exp. Defaults to NULL, which translates to ifun(object$call.sitar$x) and inverts any transformation applied to x in the original SITAR model call.

yfun

an optional function to apply to y to convert it back to the original scale, e.g. if y = sqrt(height) then yfun = function(z) z^2. Defaults to NULL, which translates to ifun(object$call.sitar$y) and inverts any transformation applied to y in the original SITAR model call.

Details

The solid line gives the velocity results from the numerical method. The dashed line gives the velocity results from the quadratic function method. The data points are velocities predicted from the SITAR model corresponding to the observed ages.

Author(s)

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

Examples

library(sitar)
###x and y not transformed
m1 <- sitar(x=age,y=height,id=id,data=heights,df=5)
###check velocities of id=1 and id=7
plotvel(m1, candid=1)
plotvel(m1, candid=7)

###x transformed but not y
m2 <- sitar(x=log(age),y=height,id=id,data=heights,df=5,fixed="a")
plotvel(m2, candid=1)
plotvel(m2, candid=7)

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