New answers tagged

0

Please use h2o.coef_norm() instead. When applied to a GLM model h2o.varimp() should simply return h2o.coef_norm(), but it looks like it doesn't (this is a bug). Please note this was fixed for the Python API but may not have been fixed yet for the R API.


4

tl;dr it's reasonable for you to worry, but having looked at a variety of different graphical diagnostics I don't think everything looks pretty much OK. My answer will illustrate a bunch of other ways to look at a glmmTMB fit - more involved/less convenient than DHARMa, but it's good to look at the fit as many different ways as one can. First let's look at ...


4

Have a look at the section about glmmTMB in the vignette of DHARMa. It seems to be an issue with regard to how predictions are calculated given the random effects. As an alternative, you may try the GLMMadaptive package. You can find examples using the DHARMa here.


0

You're right, this is definitely a good situation for a mixed model. The random intercepts/slopes you use depends on a few factors, such as the desired interpretation and power. I would start at the simplest (random intercept) model, and add your random effects in terms of importance; because without a huge sample you can run into issues with convergence. So ...


1

Note that in both sets of comparisons, the estimates and standard errors for the comparisons within the same exposure match up. It is only the $P$ values that differ. The reason is that the $P$ values in the first set are adjusted for multiplicity, and the $P$ values in the second set are not. The first set of EMM comparisons consists of ${8\choose2}=28$ ...


0

Regardless of the field that you are working in, whenever the x and y variables show non-normal distribution or have ordinal scales; use cor(x, y, method = "spearman") or cor(x, y, method = "kendall"). Use pearson when your data is normally distributed. If the logarithmic transformation (or other transformation methods) results in unskewed and normally ...


6

Since the formula for calculating the correlation coefficient standardizes the variables, changes in scale or units of measurement will not affect its value. For this reason, normalizing will NOT affect the correlation.


0

Your question is a bit vague. If you have 2 variables X and Y ad two groups A (n1 = 32) and B (n2 = 21), then what are 310 and 430 items? Your data are 2-dimensional, aren't they? In fact, n1 and n2 in the cocor::cocor.indep.groups() function are the size of groups as it is written in the package's documentation. Here, I make an example for the dataset ...


0

As I understood, you have two binary independent variables named Group and Condition and one binary dependent variable named Correct_Humorous. You are going to need a glm with the binomial family and logit link: fit <- glm( Correct_Humorous ~ Group + Condition, family = binomial(link = logit), # logistic regression data = data4 ) summary(fit) ...


0

There will be the usual problems of factor analyzing ordinal variables, but there are no additional problems because of different scales - these get dealt with in the analysis. But treating the variables as if they were continuous is not going to be correct. See this question and the answers thereto.


3

This is a classic time series problem and there are lots of papers on it (see Tong JRSSA 1977 for an early discusson). You could transform the series (set lambda = 0.5 for example) and you will get slightly better ARIMA results. But the main problem is that the cycles are of unpredictable length, so any model you produce will struggle to capture the ...


1

If you would like to carry out variable selection in the presence of high collinearity I can recommend the l0ara package, which fits L0 penalized GLMs using an iterative adaptive ridge procedure. As this method is ultimately based on ridge regularized regression, it can deal very well with collinearity, and in my simulations it produced much less false ...


1

It sounds like Friedman's test is an appropriate approach to answer the first question. And, yes, I would avoid the Scheirer-Ray-Hare test. It appears to not be well regarded from a theoretical standpoint, but also in my experience it will fail to find a significant interaction effect in cases where other tests will find one. For a model more complex than ...


0

First, you should not remove non-significant terms from a model simply based on p-values, that is not their purpose. Second, to get means for each combination of groups (and comparisons) use a linear model.


1

In the model m1s, the differentiation is with respect to Var, not to the scaled version of Var; so, yes, the results should be the same as for m1. Just to illustrate, I'll show those results: > lstrends(m1s, ~Type, var="Var", adjust = "tukey", transform="response") Type Var.trend SE df asymp.LCL asymp.UCL A -0.0289 0.00344 Inf -0.0357 -0....


2

First, I'd change the axes to say "Months on Medication" and "Number of Patients." I'd report the number of zeros, and be able to verbally address the issue of zero-inflation. Definitely report the estimated overdispersion parameter, because one certainly expects overdispersion when medication use month-to-month is clearly correlated. And report the usual ...


0

You could use a two-part mixed effects model for semi-continuous data. This combines a logistic regression for the dichotomous indicator that the outcome is zero or not with a log-normal model for the continuous part. Two-part mixed effects models are available in the GLMMadaptive package I’ve written - you can find a sample analysis here.


1

The motivation for performing an eigendecomposition of the design matrix is indeed, as you mentioned, to reduce the computational cost of the algorithm. Fitting splines, particularly in the case where $d > 1$, is a very computationally intensive task - in the paper you cite, Wood mentions that all of the algorithms for $d > 1$ are of $O(n^3)$ ...


0

It really depends on your scenario, which there's very minimal information on. If you do end up running the ANOVA, make sure you use type III SS; as these tests are not reliant on cell size or order of parameters. I am not quite sure how to get type III for the individual parameters without manual multiplication by contrast (will add example within a day or ...


0

No, it does not mean that BL is significantly different from treatment. Treatment and BL are two different variables, the first is a factor the second is numeric. An ANOVA tells you, that a model with both variables treatment and BL is a significantly better model than a simpler model with just treatment variable (in terms of fit). These two variables ...


0

disclaimer: I know nothing from plm. I encountered your question in the review queues and wanted to try to understand the statistics. Then I found this resource: Estimation of error components models with the plm function by Yves Croissant 2019-07-23 https://cran.r-project.org/web/packages/plm/vignettes/plmFunction.html it says: index helps plm to ...


3

I don't think permutation feature importance can identify overfitting per se, it could however hint whether a good amount of noise has been modelled (overfitting) when features that you know for a fact to be significant, aren't deemed significant (pretty much your case). If you go with splitting, significantly smaller training error than test error indicates ...


2

As mentioned at previous answer - time is continuous. On the other hand dates are discrete. Delivery companies often work on daily bases, delivering for example every day at 9-10AM. As most discrete distributions have their continuous equivalents, you can choose what is more appropriate here. You can also make use from both of options. Personally I would ...


2

Unless you're using an arbitrary precision data type (if you're not sure, then very likely not) your observations will always be rounded to some finite precision on your computer, so in that sense appear 'discretized'. I would generally model arrival times as a continuous variable, unless for some reason it doesn't make sense to think of something taking 5.5 ...


2

It seems like what you want is to avoid reference cell coding. You want a slope and intercept for the effect of X on outcome at each level of treatment. You need to modify @cdtip's code to exclude an intercept, and you should get what you need: lm(outcome ~ treatment/X - 1) Now, each coefficient treatmentA:X, etc., is the effect of X on the outcome for ...


2

Why do a statistical test of this? Any test will have the usual problems of p values - that is, the result will depend partly on sample size. When you have two data sets, you know that the same line doesn't fit both equally well (except perhaps for some constructed data sets and some very small data sets). So, graph both and look at them. Are they ...


0

It looks like you are trying to perform a chi-square goodness-of-fit test. That's about all I can suss out, so I can't say the following is correct for your purposes. In this case, the last line of your code could be replaced with the following. My advice is to perform the desired test by hand, or to compare to a published example similar to yours, and ...


2

Your case is that of comparing two models with same variables but different set of data points. You can use chow.test from library gap. However, as mentioned in my comment above, you need to remove common data points from one of the data frames. Following is the code for this (and also the result I obtained): set.seed(3) data1 = iris[sample(c(1:dim(iris)[1]...


0

Multicollinearity cannot, logically, be "solved". Rather, it indicates that you cannot readily tease apart the effect of two or more predictors. Regularisation (lasso, ridge, elastic net) try to reduce the effect of collinarity on parameter estimation and thereby improve prediction. Also, when the correlation structure changes (in time, in space, in ...


3

You can extract the prediction for a single tree from the predictions for the whole forest if you include the predict.all = T argument. For example, if you made a forest from the iris data and want the predictions for tree 1: model <- randomForest(iris[,-5], iris[,5], ntree=10) predict(model, iris, predict.all=T)$individual[,1] # predictions for tree 1 ...


-1

First convert your matrix for example x without response into numeric . After that the significant coefficient(s) that contributing to the model find by search colnames or rownames as in the data structure the variables are.


0

if you read the Final remarks of reference article of the package in page 25, it is written : "As a further step, factors with interaction terms will require the procedure to be able to respect a pre-defined hierarchy, i.e., some orders of regressors (interaction before main effect) must be excluded from the possibilities. This would also be a desirable ...


0

Yes, that would be appropriate. You can run a two way ANOVA as follows (using the built in mtcars data set as an example). summary(aov(mpg ~ cyl + gear, data = mtcars)) which yields ... Df Sum Sq Mean Sq F value Pr(>F) cyl 1 817.7 817.7 78.29 9.82e-10 *** gear 1 5.4 5.4 0.52 0.477 Residuals 29 ...


1

At first, please remember, that multicollinearity is not a binary thing, therefore it can not be handled or not-handled as 0 and 1. Every method used to handle multicollinearity will handle it to some extent - better or worse - often risking removing of important variables, when the filter is stronger or just by bad luck. One may think about it as of a trade-...


1

PC1 means the first principal component, the direction that carries the most variance. You can project your data onto the first few components and perform clustering. You might like to look at sdev output to read off the standard deviation.


0

Optimization of Fourier pairs based on AICc values. This is for yearly and monthly seasonality on data without weekends. The ranges 0:10 and 1:20 should be changed accordingly for different seasonal periods. Or increased for a broader search. msts_test <- msts( test , seasonal.periods = c(21.66,260)) my_aic_df <- matrix(ncol = 10 , nrow = 20) for(i ...


2

First, check how you have constructed your data table. The list of "suspicious column names" contains 15 pairs of names like {g_Drama, g_Drama.1} and {g_Horror, g_Horror.1}. Furthermore, within each of those pairs, the correlations with the outcome variables are identical, at least to the 2 decimal places that you display. That suggests that each pair might ...


0

As @Glen_b described the mode of a continuous distribution is not as straightforward as it is for a vector of integers. This R code will get the mode for a continuous distribution, using the incredibly useful hist() function from base R. As @Glen_b described this involves putting observations into bins - discrete categories where if the observation falls ...


0

Having learnt the principle from BruceET's answer, I have created another version that avoids simulation. Instead I use dbinom() to calculate the probabilty of getting the observed result over a regularly spaced array of p values. These values yield an unscaled discrete-valued pdf, which is integrated to create a cdf, and then linear interpolation is used to ...


2

Note that the p values from cox.zph() shouldn't be thought of in the same way that you use p values in standard tests of null hypotheses. The burden is on you to demonstrate that PH holds; it's not enough to show that you can't rule out the PH null hypothesis because p > 0.05. A p value on the order of 0.1, as you have for some of your cox.zph() results, is ...


0

The problem of constructing prediction intervals for random forest predictions has been addressed in the following paper: Zhang, Haozhe, Joshua Zimmerman, Dan Nettleton, and Daniel J. Nordman. "Random Forest Prediction Intervals." The American Statistician,2019. The R package "rfinterval" is its implementation available at CRAN. Installation To install ...


1

The whole train/test/validation procedure is only used for two things, model selection and generalization error estimation. Once you have picked the algorithm you will use and estimated its generalization error you need to then go back to your entire dataset. Perform cross validation on the whole dataset to find optimal hyperparameters (but keep the ...


1

Correct regression is probably the tool for you to use to test the constancy of parameters over time. Prediction is not in play ...model identification and possible differences in model parameters are in play. Actually seeing your data might be helpful here. It sounds to me that you are trying to identify a significant change between two regimes before and ...


2

No, there is no zero-inflated quasi-Poisson family in mgcv. For a continuous response with point mass on 0, you can use the tw() family to fit a model where the response is assumed to be a draw from one of the Tweedie family of distributions with support on the non-negative real values. The specific Tweedie distributions allowed in mgcv are those where the ...


0

Use the t-test: R-code x <- as.factor( c( "A" , "B" , "B" , "A" , "A" , "B" , "A" , "A" , "B" , "B" )) y <- c( 88 , 56 , 80 , 49 , 61 , 21 , 48 , 55 , 42 , 66 ) t.test( y ~ x )


1

These do not refer to the variance. They are two main approaches in variable importance measures for GBMs. The first (per Breiman (2001) for example) the importance of a predictor is represented by the average increase in prediction error when a given predictor is shuffled (permuted). This is similar to what random forests are doing and is commonly referred ...


0

No, it is not necessary and not needed at all. You just choose the $k$ nearest point to your test point, and average their target values to predict the target value of your test point. The distances are calculated using your features, i.e. $X$ and are sensitive to scale, not the target variables.


3

When you include the term (trialtype | subject) in your model, and given that trialtype is a categorical variable with four levels, you include four separate correlated random effects per subject (i.e., you postulate an unstructured covariance matrix for your random effects). This is a complex model with many variance components, and it's no surprise that it ...


1

Cross-validation is another approach to avoid over-optimism. I ran a logistic model with your data, using 4-fold cross-validation (i.e. fit the model on 75% of the cases, and then measure the error on the remaining 25% -- then do this 3 more times). I get a cross-validated ROC area of .788, so your .81 looks pretty accurate. I think EdM's suggestion of ...


Top 50 recent answers are included