New answers tagged

0 votes

Binary logistic regression: p-value of predictor containing all cases of response=1

A couple notes first regarding your questions: Is logistic regression inappropriate for such data? In theory, yes. Models with this predictor explain the most variance, but reporting results with ...
Shawn Hemelstrand's user avatar
1 vote
Accepted

Clogit and no variation in strata

If you mean the clogit function in the survival package, strata with no variation in the predictor are not dropped; they just ...
Thomas Lumley's user avatar
2 votes

Why does centering predictors resolve non-convergence in lme4?

I doubt that centering your predictors will have much of an effect on convergence in itself. What may help in some cases is rescaling. The combination of the two operations is usually called '...
PBulls's user avatar
  • 3,633
1 vote

Can tbats forecast partial years

TBATS models seasonality in the data with periods equal to the seasonal periods specified. If your data is not periodic, then it's not going to find the seasonal patterns, and may just settle for a ...
Rob Hyndman's user avatar
  • 56.4k
1 vote

Optimizing relative errors with GAMs

This is very easy to do in mgcv by specifying weights for the observations. This is the weights argument in the ...
Doctor Milt's user avatar
  • 2,672
2 votes
Accepted

How to constrain a GAM to non-negative values

For a concentration, the data will be either strictly positive or they will be left censored. A 0 observation is not technically possible in most situations as in general we are measuring using ...
Gavin Simpson's user avatar
0 votes

Random effect variance with or without fixed-effects intercept

I agree with @Roland's comment. What values does SAM_Aro take? Keep in mind that the mean of both sets of random intercepts (participant and video) is, by ...
Doctor Milt's user avatar
  • 2,672
1 vote

R: Computing relative weights for linear mixed model importance?

The dominanceanalysis::dominanceAnalysis function is what you need. Please see this: https://github.com/clbustos/dominanceAnalysis/
Le Quang Nam's user avatar
0 votes

R package that calculates out-of-sample pseudo $R^2$ used to compare probit models

I’d implement it myself using MLMetrics::LogLoss. $$ R^2 = 1 - \left(L_1/L_0\right) $$ $L_1$ is the out-of-sample log loss incurred by your model, calculated from ...
Dave's user avatar
  • 60.8k
1 vote

How to constrain a GAM to non-negative values

One common way would be to specify a link function with non-negative domain for a response distribution with non-negative support via the family argument.
statmerkur's user avatar
  • 5,810
0 votes

Model Convergence after R Crash. (Warning: Model failed to converge with max|grad| = 0.00247628 (tol = 0.002, component 1))

Without knowing anything else about how you obtain the subsets of your full data to generate df1 or df2, I can only speculate. If you randomly subsample from the full data set without fixing a seed ...
Bill Shipley's user avatar
6 votes

Understanding spline transformation and regression coefficients

Shawn’s answers are excellent. To add a few other considerations: Linear splines are very easy to interpret because parameters represent an initial slope and increments in the slope as you cross ...
Frank Harrell's user avatar
7 votes

Understanding spline transformation and regression coefficients

Conceptual Discussion Roland seems to present an answer for how one can derive the function based off the programming. I think your core question however remains unanswered...what do the coefficients ...
Shawn Hemelstrand's user avatar
1 vote

Link function for exponential regression

Your two approaches are similar, but different. On the one hand, the identity link models $$ E[\log(y) \mid X=x] = x^T \beta $$ where as the log link models $$ \log(E[\log(y) \mid X=x]) = x^T \beta $$ ...
Demetri Pananos's user avatar
3 votes

When analysing time series data with lme4, how do you include both a step-change and a slope-change?

Your model currently has a single fixed time parameter, which is the same for all observations. The estimate is very slightly negative, so all your predictions ...
PBulls's user avatar
  • 3,633
0 votes

association of epigenetic age with categorical variable

I would personally first check what is the distribution of the response variable. It looks like there is no simple effect of the size of the buffer zone on the epigenetic age acceleration. 1000 m is ...
CaroZ's user avatar
  • 594
0 votes

lme4: adding covariates and interpreting output

I hope this helps: Question 1: This is code assuming you have 3 predictors (pred1, pred2, pred3). A'covariate' is just treated the same as other predictors in the code. I use 'Response' as your ...
SilvaC's user avatar
  • 452
0 votes
Accepted

Error: PIRLS loop resulted in NaN value in GLMM (glmer) model with Gamma distribution

One of the key assumptions of using linear regression techniques is that the modeled relationship is linear. Plotting your data it seems that at least for ...
Stefan's user avatar
  • 5,811
0 votes

R: Why does type III ANOVA require contrasts that sum to zero?

The full model is overdetermined and needs to drop one of the factors (which get turned into n-1 dummy variables instead of n dummy variables, see: The dummy variable trap). Which factor is dropped is ...
Sextus Empiricus's user avatar
4 votes

Setting priors for categorical variables in bayesian multilevel model analysis with BRMS package (repost)

As far as I know, if you are just considering the priors for the slope values, then I believe that is fairly straightforward for categorical variables like yours. Since categorical variable ...
Shawn Hemelstrand's user avatar
2 votes
Accepted

Transforming data for ANOVA or GLM

In my honest opinion you should not use aov() for modeling repeated ecological count data. Further, transforming your outcome variables is usually not the best ...
Stefan's user avatar
  • 5,811
0 votes

Sampling weights in Cox proportional hazards models

The two will give identical point estimates in this setting. Standard error estimates might be slightly different due to different degree-of-freedom corrections (like the $n$ vs $n-1$ issue in ...
Thomas Lumley's user avatar
0 votes
Accepted

how does classError work in mclust package?

The documentation of mclust::classError explains that If more than one mapping between predicted classification and the known truth corresponds to the minimum ...
dipetkov's user avatar
  • 9,530
1 vote
Accepted

How to interpret the plots of smooths from a GAM object

Answer I'm not sure which text you are referring to, but I think the answer is fairly straightforward. Our $x_1$ here clearly has a consistent positive linear effect on $y$ and has a very narrow ...
Shawn Hemelstrand's user avatar
0 votes
Accepted

Specifying a model with random effects for a strip-plot designed experiment in R

Let's name the models under consideration for ease of reference. Using R's formula notation: ...
dipetkov's user avatar
  • 9,530
1 vote
Accepted

Simulate a distribution from a fitted beta-regression model for a density plot in R

See Cribari-Neto, F., & Zeileis, A. (2010). Beta regression in R. Journal of Statistical Software, 34(2), Article 1. https://doi.org/10.18637/jss.v034.i02 for formula and definition in ...
DrJerryTAO's user avatar
  • 1,325
0 votes

nlme estimates near zero variance for the random effects

As others have pointed out, the problem is singularity that the estimated variance of random intercepts is at its boundary zero. In such cases, lme4 prints messages ...
DrJerryTAO's user avatar
  • 1,325
2 votes
Accepted

Understand and specify a generalized logistic model in R

Just wanted to share what I did in the end as suggested by @COOLSerdash : First, I took @BenBolker 's hack for a custom power-logistic function which can be found here: https://rpubs.com/bbolker/...
Stefan's user avatar
  • 5,811
2 votes
Accepted

Check assumptions in generalized linear model binomial family

Since the treatments are categorical, your model as it stands looks like $$ \log \left( \dfrac{p_i}{1-p_i} \right) = \beta_0 + \sum_{i=1} \beta_i \mathbb{I}(trt_i = i) $$ Essentially, you're ...
Demetri Pananos's user avatar
3 votes

Check assumptions in generalized linear model binomial family

Standard residual plots tend to not be very useful for logistic regressions or other forms of GLMs. I would instead run some simulated residuals and see if their output looks normal. The ...
Shawn Hemelstrand's user avatar
3 votes
Accepted

Linear mixed model fixed and random effects with physiological data

Your setup of the linear mixed model is incorrect. First, time and age are both continuous predictors that apply to all individuals and should be modeled as fixed predictors. Regression splines would ...
EdM's user avatar
  • 90k
7 votes

multiple linear mixed models - multiple comparisons adjustment

As Peter Flom said, there are many reasonable points of view to what one should do in this situation, and no one correct answer. However, since you are after concrete advice, I can say what I'd do in ...
Sointu's user avatar
  • 1,424
7 votes

Missing Coefficients in Linear Regression with Multiple Categorical Variables in R

The intercept is the predicted level of the dependent variable when all the independent variables are 0 (however that is coded in your data). There are a number of ways to parametrize categorical ...
Peter Flom's user avatar
  • 117k
9 votes
Accepted

Missing Coefficients in Linear Regression with Multiple Categorical Variables in R

You need to define a reference level for each separate categorical variable, which will be absorbed into the intercept. (Specifically, R does this automatically, by using the alphabetically first ...
Stephan Kolassa's user avatar
7 votes

multiple linear mixed models - multiple comparisons adjustment

As Jacob Cohen put it, decades ago, "this is a subject on which reasonable people can differ." This has also been discussed many times here, in various contexts. See the tag "multiple-...
Peter Flom's user avatar
  • 117k
0 votes

Outputs of Granger causality and FEVD are opposite of each other

dfund takes the largest share of explaining the variance, but that doesn't mean that there is no statistical significance for dindex explaining some of the variance as well. The fevd graph expresses ...
Sextus Empiricus's user avatar
2 votes

association of soil toxic element with epigenetic aging in four different cities

There is nothing to be gained by breaking down the element abundances into quantiles. This is discussed extensively on this site, for example here. Although log transforms are often used with such ...
EdM's user avatar
  • 90k
2 votes

Modeling repeated measures data in R - Interpretation and Validation

To help make your original regression results more interpretable, I suggest that you code timepoint such that the first occasion is given a value of 0. This is because in regression models, the ...
Erik Ruzek's user avatar
  • 4,572
1 vote

Rank deficiency and interaction term not estimated

The problem is in the design; you don't really have 2x2, you have something like 2x1.5. Whenever there is high lexical complexity, there is average readability, so the interaction can't be estimated. ...
Peter Flom's user avatar
  • 117k
0 votes

Coefficient stability between two different models

Looking at basic description of ridge regression it seems this is about finding coefficients $\boldsymbol{\beta}$ for the linear model: $$ y=\mathbf{x}^T.\boldsymbol{\beta}+\epsilon $$ Where $y$ is ...
Cryo's user avatar
  • 558
3 votes

Is R's weighted sample without replacement function misleading?

There was work at the R Sprint earlier this year on adding an option to specify marginal sampling probabilities for unequal-probability sampling without replacement. It hasn't happened yet, but is ...
Thomas Lumley's user avatar
1 vote

Is R's weighted sample without replacement function misleading?

The code below is adapted from the 2023 article "Remarks on some misconceptions about unequal probability sampling without replacement" by Tillé and generates multiple samples using the base ...
LBogaardt's user avatar
  • 582
0 votes

Mixed model in lme4 package is singular

As reported there are many reasons for singularity. Your example is not reproducible for the lack of data. Could you provide some characteristics of the data e.g. the levels of each factors and the ...
Alessio's user avatar
  • 11
2 votes

Help in Understanding num.trees, mtry, and nodsize in Random forest?

I appreciate @Kat's insightful answer and inspiring visualizations provided. However, I'd like to clarify that mtry refers to the "number of variables that ...
K.Mole's user avatar
  • 121
2 votes

Robust options to fit GLM or GAM for overdispersed Poisson counts (quasipoisson or negative binomial) in R

It's not too hard to make your own quasi-adjustment function, which can be layered on top of a robust estimation procedure (or any procedure that returns Wald estimates for the standard errors of the ...
Ben Bolker's user avatar
  • 42.9k
3 votes
Accepted

Cautions or considerations when setting coefficients from linear model into the fixed-effects component of a mixed effects model

Note that to estimate the random effect, you need the fixed effects and the variance components. In particular, for a random intercepts model, the formula is $$\hat{b}_i = \frac{n_i \sigma_b^2}{\sigma^...
Dimitris Rizopoulos's user avatar
4 votes

What type of statistical tests can I use on this dataset?

Before one thinks about "tests", try drawing a graph. It's pretty obvious that more aphids are dead in the dishes with more aphids at the start, so I'd look at the proportion of aphids that ...
James K's user avatar
  • 487
7 votes
Accepted

What type of statistical tests can I use on this dataset?

I would organize the dataset differently. The easiest would be to have one line per Petri dish and per time point. Each Petri dish should have a unique identifier, meaning this identifier will come ...
CaroZ's user avatar
  • 594
4 votes
Accepted

non-significant p value in a multivariable cox regression following exhaustive model selection

There are lots of problems with "exhaustive model selection" and with stepwise. These have been covered here many times. I am not hugely familiar with glmulti (it appears to do some kind of ...
Peter Flom's user avatar
  • 117k

Top 50 recent answers are included