-
Notifications
You must be signed in to change notification settings - Fork 2
Inconsistent levels for groups 'g' defined by interaction of multiple individual covariates #9
Copy link
Copy link
Open
Description
The 'groups' argument of secr.fit() uses the base R function interaction() to form a single factor from multiple inputs (e.g. the individual covariates Sex F,M and Ageclass 1,2). The default (lex.order = FALSE) ordering of factor levels from interaction() (F.1, M.1, F.2, M.2) differs from factor(), which sorts in lexical (alphanumeric) order (F.1, F.2, M.1, M.2).
Sorting of factor levels was applied inconsistently in secr<5.3.0,
- sorted: D.designdata() (for the density model design matrix), and makeNewData()
- unsorted: secr.design.MS() (detection design matrices)
- the internal variable grp used sorted levels for multi-session data (from internal
function group.levels) and unsorted levels for single-session data (directly
from group.factor).
This causes various problems. Results are likely to have been scrambled when the
model used group 'g' defined by the interaction of multiple individual covariates.
secr 5.3.0 fixes known issues, specifically,
- all design matrices now use the default levels from interaction() i.e. lex.order = FALSE
- levels of the group factor g generated by makeNewData now follow that standard
Please report any downstream problems.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels