
Calculation of FEV/height percentiles for Cystic Fibrosis patients

Version 2.11 
Released Mar. 20, 2009

(c) Michal Kulich 2003, 2009

This is a collection of R functions which convert 
     (1) between FEV1 values in liters and FEV1 quantiles
     (2) between height values in cm and height quantiles

What is new:

     Version 2.11 includes minor bug fixes

     Version 2.10 allows to choose the reference period on which the 
     equations are based.

     Four different reference periods are available: 
         1994-2001 (used in all earlier versions)
	 1999-2006 (new default)
	 1994-2000 (early period)
	 2001-2006 (late period)


Installation and usage:

     1. Unpack fevcalc_2.11.zip into the directory you will be working in.
     2. Start R
     3. Run 
        > source("fevcalc-func.r")
     4. Use fevperc() to convert FEV1, htperc() to convert height


Contents of fevcalc.zip

  - readme.txt        (this file)
  - fevcalc-func.r    (R functions)
  - examples.r        (examples of usage)
  - fevhtcoef_99_06.RData   (data files with coefficients for different periods)
    fevhtcoef_94_01.RData
    fevhtcoef_94_00.RData
    fevhtcoef_01_06.RData

======================================================================


		     DOCUMENTATION FOR fevperc():
		    =============================

fevperc(fevL=fevar,quan=quanvar,age=agevar,ht=htvar,sex=sexvar,period)

Converts between FEV quantiles and FEV in liters

INPUT:

  fevL:       FEV1 in liters (vector)
  quan:       quantiles (scalar or vector; values 0.01-0.99)
  age:        age values (vector; 6-40 years)
  ht:         height values (vector; 105-190 cm [180 in women])
  sex:        sex values (vector, same length as ht)
              permissible codes: 1,'m','M','Male','male'
                                 0,'f','F','Female','female'
  period:     period of reference equation
              permissible values: "94_01","99_06" (moving 8-year window)
                                  "94_00","01_06" (early vs. late period)
	      Default is "99_06".

Provide either fevL or quan, not both
Provide age or ht or both
Each age has specific permissible ranges of height; if height falls
     outside the range, empty value is returned
Age, ht, sex must have equal length. Scalars are replicated as needed.


OUTPUT:

fevL was not specified -> returns a matrix of fev [L]
                          (rows=observations, columns=quantiles)
quan was not specified -> returns a vector of FEV quantiles
            If FEV falls below 0.01 quantile, 0 is returned.
            If FEV falls above 0.99 quantile, 1 is returned


REMARK:

This function loads coefficient datasets fevhtcoef_xx_yy.Rdata 
from current directory 

======================================================================


		     DOCUMENTATION FOR htperc():
		    =============================
				   

htperc(ht=htvar,quan=quanvar,age=agevar,sex=sexvar,period)

Converts between height quantiles and height in cm

INPUT:

  ht:         height values (vector)
  quan:       quantiles (scalar or vector; values 0.01-0.99)
  age:        age values (vector; 0-40 years)
  sex:        sex values (vector)
              permissible codes: 1,'m','M','Male','male'
                                 0,'f','F','Female','female'
  period:     period of reference equation
              permissible values: "94_01","99_06" (moving 8-year window)
                                  "94_00","01_06" (early vs. late period)
	      Default is "99_06".

Provide either ht or quan, not both
Provide age or ht or both
Age, ht, sex must have equal length. Scalars are replicated as needed.


OUTPUT:

ht was not specified   -> returns a matrix of heights [cm]
                          (rows=observations, columns=quantiles)
quan was not specified -> returns a vector of height quantiles
            If height falls below 0.01 quantile, 0 is returned.
            If height falls above 0.99 quantile, 1 is returned

REMARK:

This function loads coefficient datasets fevhtcoef_xx_yy.Rdata 
from current directory 
