Displaying 3 results from an estimated 3 matches for "maybe_model_matrix".
2024 Sep 23
1
model.matrix() may be misleading for "lme" models
...and object$call$data are NULL, and NULL doesn't cause any
harm when evaluated in any environment. In the latter case
model.matrix.default() can access the variables in the environment of
the formula.
With keep.data = FALSE, the function may evaluate object$call$data in
the wrong environment:
maybe_model_matrix <- function(X)
model.matrix(lme(distance ~ Sex, random = ~ 1 | Subject, X,
contrasts=list(Sex=contr.sum), keep.data=FALSE))
maybe_model_matrix(Orthodont)
# Error in eval(object$call$data) : object 'X' not found
...but then model.matrix.default doesn't work on suc...
2024 Sep 23
1
model.matrix() may be misleading for "lme" models
...LL doesn't cause any
> harm when evaluated in any environment. In the latter case
> model.matrix.default() can access the variables in the environment of
> the formula.
>
> With keep.data = FALSE, the function may evaluate object$call$data in
> the wrong environment:
>
> maybe_model_matrix <- function(X)
> model.matrix(lme(distance ~ Sex, random = ~ 1 | Subject, X,
> contrasts=list(Sex=contr.sum), keep.data=FALSE))
>
> maybe_model_matrix(Orthodont)
> # Error in eval(object$call$data) : object 'X' not found
>
> ...but then model.matri...
2024 Sep 22
1
model.matrix() may be misleading for "lme" models
Dear Ivan,
Thank you for addressing my questions with your usual thoroughness.
Please see below:
On 2024-09-21 2:51 p.m., Ivan Krylov wrote:
> [You don't often get email from ikrylov at disroot.org. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> Caution: External email.
>
>
> Dear Prof. John Fox,
>
> ? Sat, 21 Sep 2024 12:47:49