Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NAs in mrClosed #8

Closed
droglenc opened this issue Jan 24, 2016 · 1 comment
Closed

NAs in mrClosed #8

droglenc opened this issue Jan 24, 2016 · 1 comment
Assignees

Comments

@droglenc
Copy link
Owner

@droglenc droglenc commented Jan 24, 2016

NAs cause problems with mrClosed(). Need to make a catch and send the user a warning.

Here is the issue. In a Schnabel method the first sample will have no marked fish (and thus m[1]=0) and it is irrelevant how many marked fish are returned to the population after the last sample (thus, either R[length(R)]=0 or R[length(R)]=n[length(n)]. However, some users may enter NA values for these positions, which will cause an error as shown below.

> WAL <- mrClosed(n =c(321,412,178,415,367),
+ m = c(NA,45,55,93,113),
+ R = c(321,412,178,415,NA),
+ method ="Schnabel")
> cbind(summary(WAL),confint(WAL,verbose=TRUE))
 Error in if (object$sum.m < 50) type <- "Poisson" else type <- "normal" : 
  missing value where TRUE/FALSE needed  

A better result would be to catch these and replace them with zeroes with a warning sent to the user.

@droglenc droglenc self-assigned this Jan 24, 2016
@droglenc
Copy link
Owner Author

@droglenc droglenc commented Feb 6, 2016

This has been addressed in the latest development version of FSA.

The version with NAs ...

> WAL <- mrClosed(n =c(321,412,178,415,367),
+                 m = c(NA,45,55,93,113),
+                 R = c(321,412,178,415,NA),
+                 method ="Schnabel")
Warning messages:
1: NA for last sample of 'R' was ignored. 
2: NA for first sample of 'm' was ignored. 
> cbind(summary(WAL),confint(WAL,verbose=TRUE))
The normal distribution was used.
        N 95% LCI 95% UCI
[1,] 3280    2832    3898

... gives the same results but with warnings as the version without NAs ...

> WAL <- mrClosed(n =c(321,412,178,415,367),
+                 m = c(0,45,55,93,113),
+                 R = c(321,412,178,415,367),
+                 method ="Schnabel")
> cbind(summary(WAL),confint(WAL,verbose=TRUE))
The normal distribution was used.
        N 95% LCI 95% UCI
[1,] 3280    2832    3898
@droglenc droglenc closed this Feb 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.