New answers tagged

1 vote

Interpretation of binomial regression in R

[...] why is the data for smkcigst NA, even though the dataset has no NAs for it and instead has 1 for all observations? The answer lies in your question: smkcigst ...
user avatar
0 votes

How to test linear hypotheses with inequality in r using the function glht for a model in log-form?

I've happened to find the answer by searching for a solution on the internet. For all with the same problem: Just put \ and ` together before and after your variable name. ...
user avatar
0 votes

T-distribution parameters with QRM package

par.ests referes to the parameter estimates. par.ses refers to the parameter standard errors. It is maybe not so obvious, since ...
user avatar
1 vote

How to test linear hypotheses with inequality in r using the function glht for a model in log-form?

Classical hypothesis test are a bit funny for this kind of thing. Testing a null hypothesis that consists of an inequality is not all that different from testing the corresponding equation --- the ...
user avatar
  • 94.7k
0 votes

Are these effects missing from my glm output because of a possible dummy trap?

With only 5 values of Lineage you are getting yourself into trouble trying to treat it as a random effect. That typically leads to singularity problems with the ...
user avatar
  • 62.5k
1 vote

How to perform lasso on a wide matrix?

The error message indeed suggests that you don't have enough RAM. However, this answer suggests that glmnet should be able to handle this amount of data, and suggests h2o for situations where glmnet ...
user avatar
  • 3,138
3 votes

Maximum Likelihood with Categorical Variables - Does this Change Anything?

On the one hand, there are features, which are attributes of your data, stuff that you measure, and on the other hand, there are the parameters to your model. Both can be continuous or discrete. If ...
user avatar
  • 3,138
2 votes
Accepted

Compute two proportion tests (with three variables?)

Comment. One more thing: In R, the procedure prop.test is essentially the same as a chi-squared test of homogeneity, using your $3 \times 2$ table. Except for ...
user avatar
  • 50k
10 votes

Maximum Likelihood with Categorical Variables - Does this Change Anything?

The algorithm used is exactly the same: although the features are not continuous in your example, the coefficients in a regression model still are. We are optimizing the coefficients in the model, the ...
user avatar
  • 18k
0 votes

Discrepancy in degrees of freedom from R svyglm vs glm

You don't say anything about your survey design. The residual df for a svyglm object is the design df plus one, minus the number of parameters estimated. From the ...
user avatar
1 vote
Accepted

Doubt regarding inverse CDF/quantile function or qpois in R

First, here is a 4-place table of PDF and CDF values for $\mathsf{Pois}(\lambda = 9.29),$ x = 0:5 pdf = round(dpois(x, 9.29), 5) cdf = round(ppois(x, 9.29), 5) (...
user avatar
  • 50k
1 vote
Accepted

qrule mathematic interpolation in quantile estimation in R survey package

Good catch! This looks to me like a bug. Inside qrule_math(), the condition should be if (qdata$wlow <= 0) rather than ...
user avatar
  • 1,464
1 vote

mediation::mediate does not support more than two levels per model

The two levels refers to the two random effects in your model (i.e., two levels in a multilevel model). mediate() doesn't support that. Nothing to do with your ...
user avatar
  • 22k
0 votes

How to incorporate offset variable in coxphf()?

Including an offset term in a Cox model is not a good idea. You might "already know" a predictor's "effect on the hazard rate," but that knowledge is almost always imprecise. What ...
user avatar
  • 62.5k
2 votes

Can someone please help me to understand the statistics used in this code in R?

Obviously we can't second-guess what the person who wrote that code is, but: I don't know why a t-test and Wilcox test was performed Often this is done when the assumptions of the t-test are not met,...
user avatar
  • 49.5k
0 votes

Difference between cross validation vs model accuracy measures

Cross validation and model accuracy measures are used together to assess and measure prediction accuracy. Consider a setup where you have a dataset with 1000 observations of a timeseries. Using the ...
user avatar
1 vote
Accepted

Permutation test for adonis under NA model?

This was due to ignoring the case where users apply marginal tests for one-variable models. Marginal models test significances of each variable after all other variables, and if there is only one ...
user avatar
0 votes
Accepted

Three-level Meta-Analyses: correlation comparisons and correction for publication bias?

To compare the A-B and A-C correlations, you need to account for the dependency therein, not just by including random effects, but also for the dependency in the sampling errors. The ...
user avatar
  • 15.8k
0 votes

How to do likelihood ratio test to compare two panel models (plm) in R

The test amounts to testing if including log(emp) should additionally enter the model over and above the variables already contained in ...
user avatar
1 vote

Zero and One tricks for INLA?

That is not possible. INLA can only fit a variety, but still very restrictive, type of models. See for instance Integrated Nested Laplace Approximations (INLA) In general INLA focuses on models that ...
user avatar
  • 11
3 votes

Subclassification on a propensity and prognostic score grid with k × k subclasses, using R MatchIt

Unfortunately, matchit() with method = "subclass" cannot be used for this purpose, but there is a workaround. You ...
user avatar
  • 22k
1 vote

Detecting changes in time series (R example)

Lots of excellent answers are given here. Apparently, the results will depend largely on the models chosen. With that said, allow me to throw one more possibility to this old question based on a ...
user avatar
  • 171
0 votes

Why does changing factor level order of a categorical predictor affect significance of continuous predictors in a linear model with interactions?

(I don't know whether the use of ANOVA underlyingly recodes factors. If so ignore this alternative answer). In the interaction model, cont1 is the effect of cont1 at the reference level of cat (if cat ...
user avatar
1 vote

Detect trend in time series

In case somebody cares a Bayesian alternative, one possibility is the Bayesian trend detection method in the R package Rbeast. Here is a test on the given sample ...
user avatar
  • 171
1 vote

Interpreting interaction effect with ln(time) in Cox regression

Although the large number of cases makes most of your coefficients "statistically significant," your model is not distinguishing cases very successfully. The concordance of 0.503 is the ...
user avatar
  • 62.5k
0 votes

Most suitable regression line

One way to decide which model fits best to your data, is to you use the Mean Squared Error (MSE). The model with lowest MSE can be considered the best fitting model. However, there is more to it. For ...
user avatar
  • 572
1 vote
Accepted

How to extract the penalty term from the GAMM function in R and what is used to estimate the penalty terms

Q1 See ?gamObject and in particular note the $sp and $full.sp components of the fitted GAM ...
user avatar
1 vote

I have a group that contains zero data, and I want to know whether it is considered normally or not normally distributed.?

Comment in Answer format--to allow showing output from R: Clearly, there is a difference between Groups 1 and 2. You could take the position (1) that the 0's in Group 2 are real data, but simply too ...
user avatar
  • 50k
3 votes

Ideal Settings for Longitudinal Models?

There is a simple counterexample to your suggestion. Imagine a case where some units are affected by large measurement error, while others have only small measurement error. It is more statistically ...
user avatar
  • 4,881
0 votes

R: Anova and Linear Regression

ANOVA is a specific regression model with categorical regressors. It only models means of different groups i.e. intercepts. There is no slope parameter. Regression is a general methodology to estimate ...
user avatar
  • 418
4 votes

QQ plot result doesn't correspond to normality test

Just on first look, this distribution looks very short tailed, as you can see it looks kind of like this simulation with a uniform distribution
user avatar
8 votes

QQ plot result doesn't correspond to normality test

Your Q-Q plot does not show that the data is normally distributed. In fact, it shows that the distribution diverges from Gaussian (values lower than -1 and higher than 1.5 diverge from the diagonal ...
user avatar
  • 113k
1 vote

Why do fixed effects in a logistic regression model differ depending on the presence of a random slope?

Fixed effects change You do get that the fixed effects change when you add a random effect. With your example both the intercept and slope change. Below is an example of the situation. black line: ...
user avatar
1 vote

How to tell if data has homgenous variance?

For an ANOVA model like this, you have 1 mean value estimate for each of 3 groups. The residuals are the differences of each individual observation from its corresponding group mean. Roughly, the ...
user avatar
  • 62.5k
2 votes
Accepted

How to determine how much variation was due to the differences between a group?

Analysis of variance (ANOVA) provides the answer to your specific question. Here, the proper outcome to examine is Time in the ...
user avatar
  • 62.5k
1 vote
Accepted

How to fit parametric distribution to baseline hazard in cox PH model

Several thoughts: First, even if you could generate a smooth baseline survival curve beyond 130 months, it would be unreliable. That's implicit in the large confidence bands around the survival curve ...
user avatar
  • 62.5k
0 votes

Time series model in production - Re-train on the fly as as batch process?

What you can do is basically train the model for example once a day (depending on the interval), save it and append its forecasts to a copy of the array you're storing your data in so all of it could ...
user avatar
  • 121
0 votes
Accepted

Missing Prediction Intervals by R package autoTS

Not all methods of producing point forecasts are probabilistic in nature, in which case there may really be no prediction interval to report. This package is focused on point forecasts and picks ...
user avatar
  • 5,269
0 votes

Interpreting coefficients of ordinal independent variables in logistic regression in R

I understand that the influence is likely to be insignificant, but which P value do I use? What can I say about the other coefficients? The model turns the single categorical/ordinal variable ...
user avatar
0 votes

Given a specific value for a variable, how do you find the predicted value of a fixed effects multivariate regression?

You have to use I(N^2) instead of N^2, because otherwise lm() interprets ...
user avatar
  • 3,138
2 votes

XGBoost interpretation of the plot in R

XGBoost creates an ensemble of binary trees, which are built "on top of each other". I.e. you first try to find a binary tree that best approximates your data. Then you build further trees ...
user avatar
  • 3,138
3 votes
Accepted

Non-positive definite matrix problem for desired correlation structure

You have stumbled into the fact that you cannot simply make a correlation matrix by assembling individually valid pairwise correlations. There are many questions on the site related to this, have a ...
user avatar
0 votes

Cox PH controlling for multiple events

It would be simpler to think of this as a multi-state survival model, as explained in the vignette, and study both Zones together. The id values keep track directly ...
user avatar
  • 62.5k
0 votes

Fit an ARMAX model in R

As of 2022, Hyndman is using fable::ARIMA, but in his otherwise excellent time series regression guide (https://otexts.com/fpp3/) is still only showing how to do a linear regression with arima errors. ...
user avatar
  • 111
4 votes

Interpreting interaction effects for categorical reference group in regression

@EdM makes valid points - read those first. Just for reference, you could get the effects of interest along with their confidence intervals using the emmeans package. For example: ...
user avatar
  • 3,110
4 votes

Interpreting interaction effects for categorical reference group in regression

First, with the default R treatment coding of your categorical predictors, the individual coefficients for things like Story Vision are their associations with ...
user avatar
  • 62.5k
2 votes

Anova shows a main effect but not the t-test

I do not have your data but you are testing two different things. In the ANOVA model you are testing for the effect of room, time and their interaction in anxiety, in an analysis that uses the ...
user avatar
1 vote

Valid to compare variable importance ranks across RF with different responses?

I suggest thinking about this problem like an experiment. What is being manipulated/changed and what is being controlled? Thinking about the set of models like this, you might be able to see where ...
user avatar
  • 601
1 vote

SE Interpretation

The standard error it's a metric that show the deviation that your estimated coefficient could have from the estimated value (mean), that is, the error. It's a number in the same units as the ...
user avatar
1 vote

pointwise envelopes not including Theoretical line Foxall J

Please provide a minimal working example. Pooling of objects (such as simulation envelopes) is only justified when the individual objects (envelopes) were created under identical conditions. In your ...
user avatar

Top 50 recent answers are included