# Tag Info

## Hot answers tagged r

22 votes
Accepted

### Kolmogorov-Smirnov test fails to recognize a normally distributed sample

As highlighted in the comments (Alex J and COOLSerdash), there are two issues here. First, the model used under the KS test is different from the true model that generated the data. The correct way ...
• 11.6k
18 votes

### Infinite upper confidence interval using Fisher exact test in R

There's a one-sided confidence interval because you asked for a one-sided test
• 37.4k
17 votes

### Compare 90th percentiles of two samples (confidence interval, test)

You can use a bootstrap to generate a confidence interval on this quantity, and a permutation test for the P-value. Let's go over an example for both. I'm not going to assume your response times are ...
• 3,658
17 votes

### Difference between charts of rcauchy(10000) and geom_function(fun = dcauchy)

There is nothing surprising here since you're comparing a kernel density estimate based on a sample from a truncated Cauchy distribution with the theoretical pdf of an untruncated Cauchy. If what you'...
• 10.7k
17 votes

### How to generate from this distribution without inverse in R/Python?

A quick and dirty solution is to apply the inverse transform sampling in which the quantile function is computed via numerical inversion. Below is an R ...
• 11.6k
16 votes

### How can I automatically perform multiple linear regressions in R to identify the strongest predictors?

Welcome to the site. My advice is to NOT automate this. There are a variety of methods to do automated model selection (forward, backward, stepwise). Of these, the only ones that I would use are ...
• 117k
16 votes
Accepted

### Kolmogorov-Smirnov instability depending on whether values are small or big

The ways you’ve coded it, you’re asking the KS test about a null hypothesis that the distribution is $N(0,1)$. In the first set of numbers, that looks plausible. Consequently, the p-value is high. In ...
• 61k
14 votes

### If a variable is coded as yes/no/unknown, is it categorical or ordinal?

This cannot be answered without knowing exactly what 'unknown' means in your dataset. If 'unknown' refers to missing data, then it's likely best to replace them with 'NA' and analyse the variables as ...
• 18.1k
14 votes

• 123k
10 votes

### Why does re-scaling my density plot using counts change the y-axis so much?

The difference between the two figures is that one displays the probability density and the other the count density. The total probability is always one (by definition). But the total counts can be ...
• 75.7k
10 votes

### Best plot in R for count data with a broad range and lots of low frequency data

Two simple variations on the suggestion of logarithmic scale by @Stephan Kolassa are square root scale (some history as a first aid transformation for counts) log(count + 1) scale implemented ...
• 55.4k
10 votes

### Mixed effects modelling - Is there a limit for number of observations?

I will add my two cents as the two questions have very different answers, and the accepted answer only explains those very briefly. One assumption I would have to make is that all of those variables ...
• 31.4k
10 votes

### Doubts about mixed model (R vs SAS) with nested random effects

Can I ignore this warning ? You certainly can, but I doubt that would be a good idea. The problem you have encountered seems to be due to the way the variables are coded. If we look at a cross ...
• 60k
10 votes

### Help with the normality of the residuals of my regression model

Normality of the error distribution is possibly the least important assumption of linear regression. All desirable properties of OLS and of the estimated coefficients still hold regardless of the ...
• 318
10 votes
Accepted

### How does R lm() function calculate standard error of slopes with more than one predictor?

You’re missing two facets about the standard error for multiple regression. In your formula, the $n-2$ comes from subtracting the number of regression parameters $(2)$ from the sample size $(n)$, and ...
• 61k
10 votes
Accepted

### How do I present averages from different sample sizes across years?

The usual thing to do here would be to include "error bars" around your sample average giving a confidence interval for the true average from the sampled data each year. For binary data you ...
• 123k
10 votes

### How do I deal with many zero values in terms of correlation?

Because you are comparing simulated vs. true values, a correlation between the two is not the best way to evaluate the quality of your simulations. This is easy to illustrate: imagine your model is ...
• 18.1k
10 votes
Accepted

### Alternative to Friedman Test in R

The tests you cited are not appropriate due to the presence of repeated measures. The common way to deal with repeated measures is via mixed-effects linear models. I'm considering here the most ...
• 11.6k

Only top scored, non community-wiki answers of a minimum length are eligible