F.assign.1dim | R Documentation |
Assign the missing counts of either variable FinalRun
or
lifeStage
, based on the frequency distribution of the other.
F.assign.1dim(catch, present.var, absent.var)
catch |
A data frame containing records of fish itemized by combinations
of variables |
present.var |
The variable in data frame |
absent.var |
The variable in the data frame |
Function F.assign.1dim
should only be utilized when the value
of only one of FinalRun
or lifeStage
is missing, i.e., one of
these variables contains values of "Unassigned"
. If both are
"Unassigned"
, utilize function F.assign.2dim
.
Except in rare cases, only fish for which variable RandomSelection="Yes"
contribute to sampling proportions. Thus, fish for which either or
both of FinalRun
and lifeStage
are recorded, but for which variable
RandomSelection
equals "No"
, are excluded.
Function F.assign.1dim
loops individually over each unique level found in
the present.var
variable. Within each level, trap occasions, as
determined by variable trapVisitID
, are examined one-by-one in order
to estimate relative frequencies of levels in the absent.var
variable, following the exclusion of those recorded as "Unassigned"
.
In this way, an estimate of the relative frequencies of the
absent.var
, given the level of the present.var
and the
provided trapVisitID
, is obtained.
Estimation of the underlying frequency distribution in a trapVisitID
may take place by up to six sequential strategies. The application of a
higher strategy only takes place on failure of the one immediately
preceding it. The six strategies follow. In most cases, the first
applies, and so the others are not considered. In each, the overall
relative frequency of the absent.var
is obtained via examination
of...
...the levels of absent.var
with the same
trapVisitID
and level of present.var
, where
RandomSelection="Yes"
.
...the levels of absent.var
with the same trapVisitID
and level of present.var
.
...the levels of absent.var
with the same SampleDate
and
level of present.var
, where RandomSelection="Yes"
.
...the levels of absent.var
with the same SampleDate
and
level of present.var
.
...the levels of absent.var
with
the same SampleDate
, plus or minus one day, and level of
present.var
, where RandomSelection="Yes"
.
...the
levels of absent.var
with the same SampleDate
, plus or minus
one day, and level of present.var
.
Relaxation of the randomly selected condition via the lack of consideration
of variable RandomSelection
in strategies 2, 4, and 6 takes place
only within a trapVisitID
for which the preceding strategy contained
no RandomSelection="Yes"
records. The relaxation allows for the
possibility that with a small number of caught fish, all are measured. In
this case, the entire catch forms the sample and sometimes, variable
RandomSelection
is set to "No"
.
When one of strategies 3, 4, 5, 6 is used, the resulting relative frequency
of counts found in other trapVisitID
s or neighboring days may not
evenly divide the "Unassigned"
count of fish recorded in the
absent.var
variable. In this case, the plus counts are obtained by
multiplying the number of "Unassigned"
fish by the proportion of
fish in each level returned by application of the suitable strategy. When
this occurs, round-off error may occur and accumulate over the various
levels for which plus-counts are obtained. The difference between the
original "Unassigned"
count of fish and the sum of the rounded plus
counts thus may not equal zero, thus leading to "magic fish." Any non-zero
magic fish are randomly allocated to the levels for which rounding
occurred via the multinom
function. In this way, the data dictate
to which levels any magic fish are allocated. Magic fish may be positive
or negative quantities, with each being allocated in the appropriate way to
ensure that the sum of the final plus-count levels equals the original
"Unassigned"
count of fish.
A data frame catch
with any "Unassigned"
counts of fish
present in the absent.var
variable proportionally allocated to the
levels present in the present.var
variable. See Details.
WEST Inc.
F.expand.plus.counts
, F.assign2.dim
## Not run: # ---- Per trapping instance, expand plus counts for fish marked as "Unassigned" # ---- in variable lifeStage, taking into consideration the frequency # ---- distribution of variable FinalRun. catch2 <- F.assign.1dim(catch, FinalRun, lifeStage) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.