New answers tagged

1

There are two points regarding the choice of this distribution: Random effects are subject-specific coefficients, appearing in the linear predictor scale. And, the distribution of coefficient estimators is often normal (from both the maximum likelihood and Bayesian paradigm perspectives). Hence, from that viewpoint it is logical to assume a normal ...


1

A "significant" intercept is one whose estimated value is "significantly" different from 0. In a logistic regression, that means different from equal outcome group probabilities when the predictors are at reference levels (categorical) or at 0 (continuous). So just centering a continuous predictor or changing the reference level of a categorical predictor ...


2

The interpretation of the coefficients is as follows: time = -0.16462 denotes how much the average RNA viral load changes (here decreases) with unit of time for subjects with GENDER = 1. GENDER2 = -0.32416 denotes the difference in average RNA viral loads between subjects with GENDER = 2 and GENDER = 1. time:GENDER2 = 0.07643 denotes the difference between ...


4

Indeed a paired $t$-test is equivalent to a linear mixed model that you formulated as $Y_{ij} = β_0 + β_1t + a_i + ε_{ij}; \\a_i ∼ N(0, σ^2_{subject}), ~ε_{ij} ∼ N(0, σ^2_{res}); \\i=1,2,...,n; j=1,2;$ where $i$ indices the subjects and $j$ codes the two paired conditions. why wouldn't it make sense to include a random slope? The dummy variable $t$ ...


0

There are situations where it would make sense to include the predicted random effects (BLUPs) in a prediction. If you have observations on a group (e.g. a person) and you want to make predictions about additional responses from the same group, then you would generally want to include the BLUP. This is possible in statsmodels, as illustrated below. We ...


2

With the benefit of hindsight and additional experience, a relatively straightforward solution occured to me and I will post it here in case it is of use to others. With respect to question one, it is a matter of focussing on the relevant differences in trial types, redefining factors based on those differences, and specfiying a model to test possible ...


3

It is not clear whether the Pos outcome variable is a continuous random variable, resulting in error terms having the normal distribution. Note that this is an assumption behind the linear mixed model you are fitting with lmer(). Regarding the structure of the model, You have included the main effects of Group, Time and Stim, and their three-way ...


0

I think the relative merits of the models depends on the research question motivating this analysis, i.e. what do you want to estimate. the lmer model is best suited to investigate whether the level of metabolites differs between people with and without the disease, and to what extent (after adjusting for your other factors). The estimated difference in the ...


1

First, think of this just for a linear model, without any random term. Differences in deviance for a linear model can't just be compared to a $\chi^2$ reference distribution: the actual reference distribution is $\sigma \chi^2$, where $\sigma$ is the residual variance. If you knew $\sigma$, you could divide the deviance difference by it and compare to a $\...


0

This should work, in principle and it seems like there might be some bugs in mgcv::extract.lme.cov2; some variables that need to be set (including size.cg, but others are needed) are not set but later are later referenced. A key branch seems to be here: if (n.levels >= start.level || n.corlevels >= start.level) { if (n.levels >= start.level) ...


0

I think the simple answer is "yes it would be weird to use random effects for prediction." Random effects in a linear model only effect the variance of your model, not the coefficients. So random effects will change the size of your confidence intervals etc, but not predictions. So if you include random effects in your model, it may change the significance ...


0

I think the answer here is not different from any other "should it be fixed or random" decision: are you explicitly interested in which sites have a significantly higher probability of absence, or do you simply want to account for the fact that the probability of absence may vary among them? See also: What is the difference between fixed effect, random ...


0

After fighting with the problem some more, in the end I did use an imputation approach: I adjusted the number of samples for all combinations of aquarium (this is the random factor) and sampling timepoint to 6, by randomly picking one (or two) of the available observations depending on how many were missing. Then I ran adonis2 with restricted permutations. I ...


0

DHARMa tests are comparing your residuals to ones that are generated based on your model specifications. So in the first case, dispersion is higher than that of the simulations, in the second it is not. It is not overdispersion, despite the term used in the summary. It is the dispersion parameter, which for the beta is phi with variance equal to mean*(1-...


1

This question is mostly about the spatstat package. In the function mppm, models with random effects are fitted by penalised quasi-likelihood using the function glmmPQL from the MASS package. The resulting fitted objects returned from glmmPQL have likelihood equal to NA. Attempting to apply anova to the object returned from glmmPQL yields an error message ...


1

But it seems plausible to me that the above hierarchical model can be specified somehow by the correlation structure between the errors that we feed into a GLS model with our data. That's exactly how it's done. The residual variance $\sigma^2$ and the higher level variance $\sigma^2_a$ are uknown parameters, however the covariance matrix of the errors of ...


1

Confidence intervals can be used for a decision regarding a hypothesis test. My suggestion would be to rather use it to back up the information that the p-value has already given. Here is an article for you https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2689604/ Hope it helps!


0

I don't have enough reputation to create a comment but I simply want to suggest you look into Rob Hyndman's 2011 paper in which he proposes an approach to creating optimal hierarchical forecasts using generalized least squares. I imagine it is possible to apply a similar technique to non-time-series data. His 2017 paper mentions the shortcomings of this ...


0

Estimation of mixed-effects logistic regression requires numerically integrating the random effects to calculate the likelihood of the model. There are several approaches to do this and you can find more information in this post. In general, and even though setting nAGQ much greater than 1 takes more time, it is to be preferred. This will ensure that the ...


2

Indeed, the log-likelihoods of linear mixed models with different fixed-effects parts fitted with REML are not comparable. This is because what the REML approach is doing is applying a transformation into you outcome vector dep that depends on the chosen fixed effects. Hence, models with different fixed effects result in models with different outcome vectors,...


3

First of all, the 'random effects' can be viewed in different ways and the approaches to them and associated definitions may seem conflicting but it is just a different viewpoint. The 'random effect' term in a model can be seen as both a term in the deterministic part of the model as a term in the random part of the model. Basically, in general, the ...


0

If x is a level 2 predictor, then it cannot be specified as a random slope at the same level it characterizes. Imagine that we have surveyed students within classrooms about their teachers' instruction (level 1) and also surveyed the teacher about their instruction (level 2). We want to predict student achievement. We can allow the association between ...


3

The correct way to make a plot of this sort of data as Peter Flom said would be to make a line for each individual, like this: library(ggplot2) ggplot(data_ex, aes(x = time, y = score, color = as.factor(pnum), group = pnum)) + geom_line() + geom_point()+ facet_wrap(.~pnum) + theme_classic() which gets this image: if you take a closer look, you ...


2

Your plot -- although not actively misleading -- nevertheless doesn't do justice to all the fine structure of your data. A box plot can't always work well when data are granular with lots of ties: here values are reported only as multiples of 0.1. My bias is that the jittering you use can't be as clear as the stacking of identical values that is possible ...


5

Trying to find single "authoritative" definition is always tempting in cases like this, but the variety of different definitions shows that this term simply is not used in consistent manner. Andrew Gelman seems to have reached same conclusions, you can look as his blog posts here and here, or into his handbook Data Analysis Using Regression and Multilevel/...


4

The boxplots ignore the repeated nature of the data. If you want a plot of these data (and you should want one!) you can make a plot where the x axis is time, the y axis is score and each participant gets a line. With n = 38 this ought to be readable, but if not, you can separate the data into two parts, either based on some relevant independent variable ...


1

When you code your block variable as numeric and use linear model (no matter mixed or no), you silently assume that "distances" between "adjacent" blocks are the same. E.g. distance between block 1 and block 2 is the same as between block 23 and 24. And what is more distance between e.g. block 1 and block 3 is twice as big as between block 23 and 24. This ...


2

$\gamma_{00}$ is a weighted grand mean when you have unequal group sample sizes. The formula for calculating $\gamma_{00}$, from Rabe-Hesketh & Skrondal (2012): $\hat\gamma_{00} = {\sum^J_{j=1} w_j \overline y_{.j}\over \sum^J_{j=1} w_j}$ where $w_j = {1\over \hat\psi + \hat\theta/ n_j}$, $n_j$ is a cluster sample size, $\hat\theta$ the within cluster (...


3

The problem I think is a lack of identifiability on the Year smooths when you have a global smooth plus factor-by smooths of the same variable. Adding is the random factor-smooth probably isn't helping. Often one needs to change the penalty on the by smooths so that they are more easily identifiable from the data. One way to do that is to place the penalty ...


0

Group is a factor. So, so called 'reference level' is chosen for it (by default this would be its first level: Group1). All the coefficients of the model can be interpreted as a difference between 'modelled' and 'reference' level. So, in you case: (Intercept) is parameter for Group1, so Y is on average equal 0.30604 for subject in Group1 in TP=0 Y is ...


0

Q0 If you look closely at the plot for the s(Year) term, you'll see it doesn't actually include 0 everywhere, e.g. the local peak around ~2000. You likely want m = 1 on the s(Year, by = Impacted, m = 1) smooths or perhaps select = TRUE. A smooth + group smooth of the same variable can get highly concurved and the model may not be identifiable. Changing the ...


0

The output looks perfectly fine to me - your estimate divided by its standard error (-1.7223/1.2) is -1.44, which gives you the non-significant result you obtained. The ratio of the estimate of NEURO to the estimate for the intercept has nothing to do with the significance of NEURO. Also, in plots, differences can look important although they are not. If you ...


1

Let's start by clarifying what the .sig01 (etc) and .sigma represent in the output from confint(). (I figure that you understand, but other readers might not have studied so diligently.) The .sigma is for the standard deviation of the residual error. The others of the form .sig0n are for the standard deviation estimates for the random effects in the model. ...


1

I am a little unclear what your question is, and in particular what you want to know from the interaction of time-varying x with t. But let me elaborate on your current model, which is: lmer(y ~ t * x + (1 + t | id), data=df) This models y as a linear function of time, x, and the interaction of x and t. It further allows for the linear association between ...


0

Welcome to the site, Marco. The random slope is necessary for multiple reasons. Among the most important is recent methodological work by Heisig & Schaeffer, which shows that for a level 1 variable involved in a cross-level interaction with a level 2 variable, that interaction is more likely to be significant if the level 1 variable is not specified as ...


2

Yes, formally speaking teacher should a random effect but with only three levels estimation will be extremely problematic (i.e. how much we would trust a standard deviation out of a sample with just 3 items). Yes, it is hypothesis dependent. But based on the initial information, teacher assignment was not explicitly determined. We can model students as ...


Top 50 recent answers are included