[R] robCompositions: Using impCoda
Rich Shepard
rshepard at appl-ecosys.com
Tue Sep 23 00:32:23 CEST 2014
I need to learn how to apply the methods in robCompositions and have read
the package docs. Two of my six data sets of proportions contain missing
values (not collected or not present); one set has a single missing value,
the other has 3 missing values. So my first task is to learn how to properly
apply the impCoda() method to my data to impute values for those that are
missing. After reading ?impData and emulating the syntax on that help page,
without understanding how to select appropriate options for the various
components, I end up with errors and have no clue how to correctly format
the command.
The data frame:
burns.co
Filterer Gatherer Grazer Predator Shredder
date2000-07-18 0.0550 0.5596 0.0734 0.2294 0.0826
date2003-07-08 0.0734 0.6147 0.0183 0.2294 0.0642
date2005-07-13 0.1161 0.5714 0.0357 0.1696 0.1071
date2006-06-28 0.1000 0.4667 0.1500 0.1333 0.1500
date2010-09-14 0.0778 0.6111 0.0444 0.1889 0.0778
date2011-07-13 0.0879 0.5714 0.0659 0.2747 NA
date2012-07-11 0.1042 0.5313 0.0625 0.2396 0.0625
date2013-07-11 0.0723 0.5542 0.0602 0.2651 0.0482
has this structure:
str(burns.co)
'data.frame': 8 obs. of 5 variables:
$ Filterer: num 0.055 0.0734 0.1161 0.1 0.0778 ...
$ Gatherer: num 0.56 0.615 0.571 0.467 0.611 ...
$ Grazer : num 0.0734 0.0183 0.0357 0.15 0.0444 0.0659 0.0625 0.0602
$ Predator: num 0.229 0.229 0.17 0.133 0.189 ...
$ Shredder: num 0.0826 0.0642 0.1071 0.15 0.0778 ...
Emulating the syntax in ?impCoda produces this result:
burnsImp <- impCoda(burns.co, maxit = 10, eps = 0.5, method = 'ltsReg',
closed = TRUE, init = 'KNN', k = 5, noise = 0.1, bruteforce = FALSE)
Error in ltsReg.default(x, y, intercept = (xint > 0), ...) :
Need more than twice as many observations as variables.
In addition: Warning message:
In impCoda(burns.co, maxit = 10, eps = 0.5, method = "ltsReg", closed =
TRUE, :
k might be too large
Please provide pointers so I can read and learn how to correctly specify
impCoda parameters for my data sets.
TIA,
Rich
More information about the R-help
mailing list