SexRatio.fn | R Documentation |
Assign sex to unsexed fish based on fish with similar traits
SexRatio.fn(
x,
sexRatioStage,
sexRatioUnsexed,
maxSizeUnsexed,
bins = NULL,
verbose = TRUE
)
x |
A data frame or a nested list depending on |
sexRatioStage |
An integer specifying the stage of the expansion in
which the sex ratio should be applied. There is no default value and only
values of |
sexRatioUnsexed |
A numerical value within |
maxSizeUnsexed |
A numerical value specifying the right side of the
following bin |
bins |
A vector of measurement bins that were used to bin the measurement of interest. Passing the bins as an argument ensures that appropriate "like" fish are found, i.e., if a bin is missing from the data because no fish were measured that fell in that bin the code will be aware the bin is missing. TODO: This argument could be avoided if the bins were factors where all of the levels are documented. |
verbose |
A logical that specifies if you want to print messages and
warnings to the console. The default is |
Assign sex to fish that were sampled but not sexed based on the proportion of like fish that were female out of sexed fish. After assigning unsexed fish to males and females, new sample sizes of each sex are calculated and the expansion factors are augmented. The definition of what classifies as "like fish" depends on the stage of the expansion, see the Details section.
The sex ratio is calculated as the number of females divided by the sum of the number of females and males. So, the value being reported is actually the proportion of females.
SexRatio.fn()
has different behavior depending on the expansion
being performed, which is controlled using the sexRatioStage
argument.
The expansion factors in the returned data frame are unaltered for unsexed fish. TODO: Decide if the previous method is intended or if the expansion factors should be changed for unsexed fish too but to zero? Also, the stage-2 expansion does alter the number of unsexed fish but the stage-1 does not. TODO: Think about how the function alters the expansion sample sizes and did not just report a sex ratio for each stage that could be used in the expansion functions themselves. TODO: Change the message for stage-2 expansion to better reflect what the code is doing TODO: align the stage-1 and stage-2 expansion details so they are written in a similar fashion.
Stage-1 expansion:
Sex ratio from observations within a tow/measurement bin combination is applied to all unsexed fish within that same tow/measurement bin;
Sex ratio from observations within a measurement bin across all years is applied to all unsexed fish within that same measurement bin that did not have any sex ratio information available at the tow level;
Sex ratio from nearby measurement bins across all years is applied to all unsexed fish within a measurement bin with zero sexed fish. Here, nearby bins are classified as those that are one measurement unit smaller and larger than the current bin.
Stage-2 expansion:
Sex ratio of sexed fish is within a measurement bin is calculated for every strata/year combination;
Missing sex ratios for a measurement bin are filled in based on the sex ratio of all measured fish within that bin across all years and strata;
Still missing sex ratios for a measurement bin are based on the sex ratio of sexed fish for near (i.e., plus or minus one) measurement bins away across all years and strata.
Allan C. Hicks and Chantel R. Wetzel
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.