# Tag Info

1

In the two-stage approach, in the first step, you summarize the repeated measurements per peptide_Id into a single number. This inevitably leads to some information loss. To give another example, say that you measure the blood pressure of a patient ten times. Even though these measurements are correlated, they contain more information than their average. The ...

0

The way you have presented the data in the table is a start but needs some additions and changes in order to analyze the data using a mixed modeling framework. The most important thing is that each subject has multiple rows corresponding to a repeated measure. The time to read measure needs to be in its own column. Then you want to create categorical ...

1

A couple of notes: In glmmTMB() and for a normally distributed outcome, specifying the random-effects structure as (1 + factor | ID) will be equivalent to us(0 + factor | ID) provided that dispformula = ~ 0. However, this is not equivalent to compound symmetry. The compound symmetry structure typically assumes that the covariance is the for all pairs of ...

1

The lcmm() function fit a latent class linear mixed-effects model. This postulates that there are some underlying sub-populations in your data that you wish to recover. The model is estimated using maximum likelihood, and therefore it will provide you with correct inferences provides that any missing data in your outcome variable are missing at random and ...

2

You have too few observations to include in your initial model that many predictors. Also, note that for binary data the effective sample size is determined by the minimum of the frequencies of the zeros and the ones. Hence, you have very little information in your data to obtain any meaningfully stable results. Finally, as noted in the comments by EdM, ...

1

Normalizing the dependent variable as you have does not make sense. It would be one thing to take a regular z-score of it (based on the sample mean and standard deviation). Sometimes people do that to their predictors and outcome to get their coefficients into an effect size metric - 1 standard deviation increase in predictor is associated with XX standard ...

1

You can do this in the R package mcp. Although your actual full model may be outside the scope of mcp, this is a way to do "random effects" change points. The mcp package contains a demo dataset called ex_varying: > library(mcp) > head(ex_varying) id x id_numeric y 1 John 1 5 30.792018 2 John 5 5 1.027091 3 John 9 ...

0

I will guess that students are nested in schools (i.e. each student only appears in one school), but tests are crossed with respect to both students and schools. This means that each test is taken by several different students, each student takes several different tests, each test is administered in several different schools, and each school administers ...

5

A couple of extra notes on top of what @RobertLong already answered: As Robert also noted, the interpretation of the coefficients from generalized linear mixed models are conditional on the random effects. Most often this is not the interpretation you are looking for. For more info on this check here. You have fitted the model with the default Laplace ...

0

You are correct that you can use either OLS (lm) to analyze nested data such as the toy data you have here. In doing so, you included dummy variables for each of the mountainRange groups except for a reference group. This is called a no-pooling model because no information is shared between the various mountainRange groups. Each gets its own intercept, ...

8

The interpretation is the same as for a generalised linear model, except that the estimates of the fixed effects are conditional on the random effects. Since this is a generalized linear mixed model, the coefficient estimates are not interpreted in the same way as for a linear model. In this case you have a binary outcome with a logit link, so the raw ...

5

Assuming that you have multiple or repeated measures/observations per state, then yes, it makes sense to fit random intercepts for state. You are correct that random effects are used when the observed levels of a factor are taken from a wider population, however that is not the only justification. If you have a large number of levels and there is correlation ...

0

One important point is what you mean by "a1:c4 at day 1 are different from a1:c4 at day 2 and so on". If this means that the a1 from day 1 is not more linked to a1 from day 2 that to a2 from day 2, then you don't have 10 simulations, but 10x30= 300 simulations (90 from category A, 90 from category B and 120 from category C). You should name them differently (...

3

It doesn't make sense to fit random slopes for Days without including it also as a fixed effect, unless you know the the overall effect of Days is zero. Try including it also a a fixed effect. If it still doesn't converge, try removing Days as a random slope, and just keeping it fixed. If the first measurement of Days is much above zero, then you might ...

2

The multilevel model allows you to simultaneously model within- and between-plot variation. Consider a simplified multilevel model, with the Xs representing within-plot variables and W representing a between-plot variable. The within-plot model: $y_{ij}$ = $\beta0_j$ + $\beta1_jX_{1ij}$ + $\beta2X_{2ij}...$ + $e_{ij}$ Here you can include as many X ...

2

You could consider using a two-part mixed-effects model for semi-continuous data. This combines a mixed-effects logistic regression for the dichotomous outcome $\mbox{I}(x_1 = 0)$ with a linear mixed model for the logarithm positive responses $\log(x_1)$ for $x_1 > 0$. This model can be fitted, for example, in the GLMMadaptive package in R. For an ...

3

The point that is made in this paper is with regard to the conditional versus marginal interpretation of the regression coefficients. Namely, because of the nonlinear link function used in the mixed effects logistic regression, the fixed effects coefficients have an interpretation conditional on the random effects. Most often this is not the desirable ...

4

The model you discuss in your quesiton can be written as $$y = X \beta + F b+e$$ where $X$ is the matrix with columns equal to $1, x, x^2, x^3,...$ and $F$ is a matrix which columns are obtained by computing the truncated polinomials. The (penalized) objective function is then: $$Q_{p} = \|y - X \beta + F b\|^2 + k\|b\|^{2}$$ Only the $b$s coefficients ...

5

I agree that this can be a little confusing. Some authors avoid setting it up in this way. The important point is that the $\alpha_{i}$ are not estimated individually, instead they are subsumed into a general model and the usual assumption is that they are normally distributed, with an unknown variance, which is to be estimated. Focusing on the main point: ...

1

As long as you have the same dependent and independent variables measured on all individuals, regardless of cluster membership, then you can use lmer to model your data. However, you state that each cluster has its own set of both observations and variables. Does that mean you have a unique set of variables that you measured on cluster A and then ...

1

Thank you for the additional explanation in the comments about your outcome. They help in thinking about a way to move forward. I will first focus on that issue before sharing why I find your solution to move to a linear model problematic. With regards to $x_1$ and using a tobit model, it is critical to note that tobit regression works under the assumption ...

5

If you have only two measurements per subject, then it would be more logical to first start with only one random intercept, i.e., $$\log(\texttt{Weight}_{ij}) = \beta_0 + \beta_1 \texttt{Gender}_i + b_i + \epsilon_{ij},$$ where $b_i \sim \mathcal N(0, \sigma_b^2)$ denotes the random intercept for the $i$-th subject, and \$\epsilon_{ij} \sim \mathcal N(0, \...

2

For a video I'd recommend the MIT 18.650 Statistics for Applications course see lectures 21-24. Also the Princeton website for their courses on the subject https://data.princeton.edu/wws509

1

As @Dimitris Rizopoulos notes in another answer, were you to model the age categories as random effects you would be assuming that the coefficients for the age categories represent a sample from an underlying normal distribution. Think about whether that is a realistic or a useful assumption. In terms of being a realistic assumption, what is the underlying ...

3

Since you say : the effect of snpA as the idea is that the AA patients are protected, AB are at low risk and BB are at high risk. this implies that you should fit snpA as a fixed effect, not random. Besides, since it has only 3 levels and the levels you have are the total population of such levels for that genotype, it would not make much sense to ...

7

However this solution doesn't take into account the two replicates for each visit or separate visits. Correct. How would I do this? You need to account for repeated visits for each patient, and for repeated replicates within each visit for each patient. This is because measurements for the same patient are likely to be be more similar to measurements ...

2

It does not seem to me that you need discrete random effects. In particular, your model will be something along these lines $$\begin{array}{lll} \texttt{Mean_Days_Sick}_{ij} & = & \beta_0 + \beta_1 \texttt{Mean_Salary}_{ij} + \beta_2 \texttt{Age}_{ij}^{30-40} + \beta_3 \texttt{Age}_{ij}^{40-50} + \beta_4 \texttt{Age}_{ij}^{50-60} +\\ && b_{... 2 1 . So, when I get an output of a mixed model, in any statistical package, I get the list of coefficients with its p-values. Are they Wald's? Yes, generally they are. They may be Z-statistics/tests (i.e., assuming that the sample is big enough so the standard errors have no uncertainty) or t-statistics (allowing for the uncertainty in std err due to ... 2 Some thoughts on each of your assumptions: I want to assume that measurements that are further apart in time are less correlated than measurements that closer (random slope). In theory, the random slope can help you with this, but the way you describe it here, it sounds like you believe there to be further residual autocorrelation (measurements ... 2 Yes, these models are nested and therefore you can use a likelihood ratio test to compare them. This can be simply done using the anova() function, i.e., anova(fit, fit_var) A significant p-value at your prespecified significance level would indicate that allowing for different variances for the error terms for the two groups improves the fit of the model. 5 Yes, you can first fit the model using the default treatment contrasts in R, and then you can use the emmeans package to perform the comparisons of interest, also correcting for multiple testing. 1 To assess the level of multi-colinearity between you predictors you can calculate the variance inflation factors. The function vif() from the car package should work for linear mixed models fitted by lmer(). 2 You have created the variables by sampling from a normal distribution where each variable is sampled independently of the others. Therefore there should be no multicollinearity between the variables, however there will be high correlation between the variables and the interaction term: > set.seed(22) > dat <- data.frame(blocks = rep(1:15, each = 2),... 1 I think the model you want in lme4 syntax should be written as lmer( R ~ c + Manufacturer + c:Manufacturer + ( c | sensor), data = data) This model will have sensor-specific random intercept and slopes, and manufacturer specific (fixed) intercept and slopes, so I think it address your goal of estimating how individual sensors and manufactures respond to ... 5 In r resp. lme4 the syntax would be: lmer( R ~ c + (Manufacturer | sensor), data = data) Is this correct? No. The above model specifies that observations are clustered within sensor (which is correct) but it also says that the effect of Manufacturer varies within each level of sensor (ie there are random slopes for Manufacturer), which is incorrect, ... 1 Mixed models are used to account for correlations within the levels of a grouping factor. Hence, the model Capture ~ Treatment + (1 | Trap) postulates that Capture repeated measurements from the same trap are correlated. Likewise, the model Capture ~ Treatment + (1 | Trap) + (1 | ID) postulates that Capture repeated measurements from the same trap are ... 2 The reason why you get this warning is indeed because the term factor * x expands to factor + x + factor:x, and poly(x, 2) is equivalent (but not the same because it uses orthogonal polynomials) with x + I(x^2). Hence, you have two times the linear term for x. As a solution, you could try specifying the following formula y ~ factor + poly(x, 2) + factor:x. ... 2 You can indeed compare the group at specific time points when time is treated as a continuous variable. In general, you can test the following hypothesis$$\begin{eqnarray} H_0: X_1 \beta = X_2 \beta\\ H_a: X_1 \beta \neq X_2 \beta \end{eqnarray}where \beta are the fixed effects of the model, and X_1 and X_2 are two design matrices specifying the ... 5 I understand that you have weekly product sales over 2 years with up to 30 categorical grouping variables, and you want to predict future sales using a mixed effects model. You can try to use a mixed effects model for prediction/forecasting, although I personally would advise caution. You would include the weekly sales as the outcome/response, and any ... 4 Noting that (A + BCD)^{-1} = A^{-1} - A^{-1}B(C^{-1} + DA^{-1}B)^{-1}DA^{-1} we can write \begin{equation} H^{-1} = (ZGZ^\top + R) = R^{-1} - R^{-1}Z(G^{-1} + Z^\top R^{-1}Z)^{-1}Z^\top R^{-1}. \end{equation} Using H^{-1} we can write \begin{equation} \begin{aligned} GZ^\top H^{-1}ZG &= GZ^\top R^{-1}ZG - GZ^\top R^{-1}Z(G^{-1} + Z^\top R^{-1}Z)^... 4 However, what risk would I also take by using a random slope (which I find reasonable in this case) instead of a common slope? Provided that the model converges, and the estimates for the random effects are not unreasonable (ie. they are not close to zero) there isn't really a risk. Random slopes allow the effect of the variable to be different in each ... 2 Possible reasons why you get different results from the two packages include The default of glmer() is the Laplace approximation and not the adaptive Gaussian quadrature. You could try refitting with glmer() and increase the nAGQ argument. The optimization procedure in one of the two packages was not completely successful. You could try fitting the model ... 1 Mixed effects models are used to account for correlations in grouped/clustered data. As far as I can see, in your experiment measurements on the same box could be expected to be correlated. In this case you could include random effects for the Box grouping factor. If you happen to work in R, then with package lme4 you could use something like the following: ... 1 The point in that the estimator for the marginal covariance matrix of Y, i.e., \hat \Phi = {(X' \hat V^{-1}X)}^{-1} will be a biased estimator of \Phi = {(X'V^{-1}X)}^{-1}. If I see correctly in your simulation, you compare \Phi with the empirically determined variance of \hat \beta, not \hat \Phi. Nonetheless, this bias is not that great. Check ... 2 We have that\mbox{cov}(u, \tilde u) = E \Bigl [ \bigl \{u - E(u) \bigr \} \, \bigl \{ \tilde u - E(\tilde u)\bigr \} \Bigr ].$$But E(\tilde u) = u and E(u) = \tilde u. Note that expectations are here taken with respect to the posterior of the random effects, not the prior. Hence,$$\mbox{cov}(u, \tilde u) = E \Bigl [ \bigl \{\tilde u - E(\tilde u) \...

3

You could adopt a Bayesian approach where you can specify the random effects to follow whatever distribution you want, provided it is supported by the software you use. WinBUGS, JAGS and Stan should all be able to do this, with multivariate responses. You could use the native software itself, or call it from within, for example, R or Python.

2

It doesn't necessarily matter that the outcome variable happens to be a standard deviation. That would be a decision made due to the research question. Since the researchers are interested in modelling precision, this would seem to be appropriate. The important thing, to make valid inferences, is that the distribution of the residuals is approximately normal....

1

You can have a standard deviation as an outcome in a regression model, multilevel or otherwise. The question is whether doing so leads to a model that makes sense and does not violate any of the regression assumptions as it relates to normality of the residuals. Regarding the residuals, you will have to check that yourself by looking at residual plots (e.g., ...

3

I've made a few example models which should be nested if you just test them in order. The model I believe best is chickm6 which: removes the baseline Time 0 Diet effect, which is intuitive since at Time 0 (I would imagine at birth), the Diet should not have any effect on chick weight added a linear two-piece spline, with the knot placed at Time 6 (somewhat ...

1

Came across a current online review piece on 'Zero-One Inflated Beta Models', by Karen Grace-Martin in "The Analysis Factor", outlining the proposed solution (noted above by Matze O in 2013) to address the 0/1 occurrence issue. To quote parts from the non-technical review: So if a client takes their medication 30 out of 30 days, a beta regression won’t ...

Top 50 recent answers are included