f.spade {SPADE.RIVM} | R Documentation |
Function for the estimation of habitual intake distributions as function of age,
based on two short-term intakes per person.
Daily and episodical intakes can be handled by f.spade
.
Results can be presented per age unit or per age class and scaled
survey weights are allowed.
Comparison with cut-off values (EAR 2x, AI 1x, UL 2x) are integrated in SPADE.
function (frml.ia, frml.if, data, min.age , max.age, sex.lab, weights.name = NULL, lambda = NULL, ia.method="one.pos", outlier.ok=F, automatic.ok = T, backtrans.nr = 1, n.ppa = 5000, eps.prob = 0.0001, eps.norm = 0.0001, prb = c(0.05, 0.25, 0.5, 0.75, 0.95), EAR.names = NULL, EAR.distr = NULL, EAR.vc = NULL, AI.names = NULL, UL.names = NULL, age.classes = NULL, dt.pop = NULL, verbose=T, plot.dev = 4, colors.ok=T, R.ok = F, spade.output.path=SPADE.OUTPUT.PATH, csv.output.path=CSV.OUTPUT.PATH, output.name = NULL, dgts = 3, dgts.distr = 0, dgts.dri = 1, bootstrap.ok=F, boot3.ok=F, boot.dt.name=NULL)
Arguments without the = sign
have to be defined by the user.
The values after arguments with the = sign
are the Default
values. These values are used by f.spade
, without being explicitely in
the user command.
frml.ia |
formula, for modelling the intake amounts,
e.g. |
frml.if |
formula or string, the formula for the intake frequencies. |
data |
data frame, with exactly 2 observations (rows) per individual and with three
mandatory variable names: id = the individual's id /
age = the individual's age / sex = the individual's gender. |
min.age |
number, the minimum age in the analysis. |
max.age |
number, the maximum age in the analysis. |
sex.lab |
string, (name between "quotes"), which indicates the gender in the analysis |
weights.name |
string, the name of the column with survey weights in |
lambda |
number, default |
ia.method |
string, indicating the method for modelling the intake amounts for episodical
intakes |
outlier.ok |
logical, option for detecting potential outliers in the amounts part during the
fit of the model. Default |
automatic.ok |
logical, default |
backtrans.nr |
number, indicating the way of back-transformation.
Default |
n.ppa |
number, the number of persons per age |
eps.prob |
number, default is |
eps.norm |
number, default is |
prb |
vector, with probabilities for the percentiles of the habitual
intake distribution to be reported. |
EAR.names |
character vector, with the name(s) of the R data frames with the thresholds
like EAR's, for which the proportion <= the threshold is estimated. |
EAR.distr |
string, indicating the distribution ( |
EAR.vc |
number, indicating the variation coefficient of |
AI.names |
name, only one name of a data frame with AI thresholds is allowed. The comparison is only qualitative |
UL.names |
vector of one or two names. See |
age.classes |
vector of numbers, to define the age classes to be reported. |
dt.pop |
data frame, with the population numbers for men and women. Consists in three
mandatory columns called |
verbose |
logical, default |
plot.dev |
number, indicating how SPADE produces the output plots. Options are |
colors.ok |
logical, indicating to use colors (Default |
R.ok |
logical, default |
spade.output.path |
string, indicating the path for the SPADE reports of the analysis and the plots.
Default |
csv.output.path |
string, indicating the path for the SPADE csv or Excel output files with
the percentiles and proportions of the habitual intake distribution.
Default |
output.name |
string, offers the user to define a specific output name of the analysis
Default |
dgts |
number, of digits in the output of the analysis steps in SPADE.
Default |
dgts.distr |
number, of digits in the reported percentiles of the habitual intake
distribution. Default |
dgts.dri |
number, of digits in the reported proportions below or above a threshold.
Default |
bootstrap.ok |
logical, indicating if |
boot3.ok |
logical, indicating if |
boot.dt.name |
string, indicating the name of the bootstrap object. This argument is needed for programming purposes and transparency and should not be changed by the user. |
For the theoretical background see the manual.
For the definitions of the data frames needed for SPADE see ...
SPADE writes all output to files outside R to facilitate the batch processing
of many micronutrients, foods or foods components.
spade.output.path |
All text files (txt) and output plots (pdf, jpg or wmf) are saved in
|
csv.output.path |
In folder |
"bin_results" |
Since R is working completely in memory, the model together with the model
results are saved in a list in the folder |
The help of this SPADE.RIVM package is concise, since a detailed manual
is available at www.spade.nl
.
The data used in this manual is available in two different ways.
The first way is needed to do the examples in the manual yourself,
e.g. to import data of different types into R.
Import data from Excel, csv or sas7bdata files
These files can be found in the library folder SPADE.RIVM/extdata
.
The SPADE.RIVM folder can be found in your library folder, which is the first
folder, localized by the R statement .libPaths()
Import data directly from R
The R statement data(package="SPADE.RIVM")
shows all available data in
SPADE.RIVM
.
Object obj
is imported into your actual working directory by
the R statement data(obj)
.
The description of the content of the data objects can be found in the manual.
Arnold Dekkers PhD
Janneke Verkaik-Kloosterman PhD
Marga Ocké PhD
National Institute of Public Health and the Environment (RIVM)
Bilthoven, the Netherlands
email: spade@rivm.nl (the SPADE TEAM)
Type in R the following statement
citation("SPADE.RIVM")
to see the citations of the 2014 paper and the manual or
visit the SPADE website www.spade.nl
##---- Should be DIRECTLY executable !! ---- ##-- ==> Define data, use random, ##-- or do help(data=index) for the standard data sets. data(DNFCS) # Copy data \code{DNFCS} (Dutch National Food Cunsumption Survey 2007-2010 # to your working directory # Example 1-part model f.spade(frml.ia=folate~fp(age),frml.if="no.if",data=DNFCS, min.age=7, max.age=69,sex.lab="female") # Copy population, a data frame with Dutch population number of 2008 data(population2008) f.spade(frml.ia=potato~fp(age),frml.if=potato~cs(age),data=DNFCS, min.age=7, max.age=69,sex.lab="both",age.classes=c(6,13,19,30,50,69), dt.pop=population2008)