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

handling aliased/inestimable parameters #16

Open
hturner opened this issue Dec 14, 2021 · 0 comments
Open

handling aliased/inestimable parameters #16

hturner opened this issue Dec 14, 2021 · 0 comments

Comments

@hturner
Copy link
Owner

hturner commented Dec 14, 2021

Diff() removes the first column of the differenced model matrices for player 1 and player 2 if it is inestimable (always the case by default as models have an intercept). However, for a model without a intercept it may be preferable to keep this column to show that the parameter is inestimable - this would be consistent with keeping other inestimable parameters.

E.g.

BTv2 <- BTm(player1=winner,player2=loser,id="ID",formula=~Matchup+ (1|ID),data=btmdata)

where Matchup is the pair of characters (character played by player; character played by opponent) and the first level of Matchup is a character against itself.

In general, may be better to explicitly identify inestimable parameters. Possibly better than relying on glm.fit to detect them as aliased parameters may not be identified if some parameters tend to infinity. E.g. set columns of model matrix for inestimable parameters to zero:

inestimable <- is.na(lm.fit(X, rep(1, nrow(X)))$coefficients)
X[,inestimable] <- 0

E.g.

BTv2 <- BTm(player1=winner,player2=loser,id="ID",formula=~Characters - 1+ (1|ID),data=btmdata)

would then work (setting parameter for last Character to zero).

Note lm() includes NA rows and columns in vcov for NA parameters, this might be sensible too, so coef matches vcov.

Alternatively, could simplify output by dropping all inestimable parameters. Possibly add as option (drop.unused.levels); should be backward-compatible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant