# Questions tagged [r]

Use this tag for any *on-topic* question that (a) involves R either as a critical part of the question or expected answer, & (b) is not *just* about how to use R.

3,657 questions
Filter by
Sorted by
Tagged with
3answers
25k views

### Is it possible to do time-series clustering based on curve shape?

I have sales data for a series of outlets, and want to categorise them based on the shape of their curves over time. The data looks roughly like this (but obviously isn't random, and has some missing ...
6answers
66k views

### How to determine best cutoff point and its confidence interval using ROC curve in R?

I have the data of a test that could be used to distinguish normal and tumor cells. According to ROC curve it looks good for this purpose (area under curve is 0.9): My questions are: How to ...
4answers
46k views

### What is the difference between R functions prcomp and princomp?

I compared ?prcomp and ?princomp and found something about Q-mode and R-mode principal component analysis (PCA). But honestly – ...
5answers
96k views

### How to calculate pseudo-$R^2$ from R's logistic regression?

Christopher Manning's writeup on logistic regression in R shows a logistic regression in R as follows: ...
3answers
90k views

### How to know if a time series is stationary or non-stationary?

I am using R, I searched on Google and learnt that kpss.test(), PP.test(), and adf.test() ...
2answers
83k views

### Interpretation of biplots in principal components analysis

I came across this nice tutorial: A Handbook of Statistical Analyses Using R. Chapter 13. Principal Component Analysis: The Olympic Heptathlon on how to do PCA in R language. I don't understand the ...
3answers
64k views

### Is there any difference between lm and glm for the gaussian family of glm?

Specifically, I want to know if there is a difference between lm(y ~ x1 + x2) and glm(y ~ x1 + x2, family=gaussian). I think ...
3answers
55k views

### Choice between Type-I, Type-II, or Type-III ANOVA [duplicate]

We have a dataset with three variables (dV: self-reported measure on scale 1-5, assumed to be metric; iV1: factor with 4 levels; iV2: factor with 8 levels). We are interested whether the dV differs in ...
2answers
47k views

### What is quasi-binomial distribution (in the context of GLM)?

I'm hoping someone can provide an intuitive overview of what quasibinomial distribution is and what it does. I'm particularly interested in these points: How quasibinomial differs to the binomial ...
4answers
26k views

### Visualizing Likert responses using R or SPSS

I have 82 respondents in 2 groups (43 in Group A and 39 in Group B) that completed a survey of 65 Likert questions each ranging from 1 – 5 (strongly agree - strongly disagree). I therefore have a ...
5answers
32k views

### Confidence interval for median

I have to find a 95% C.I. on the median and other percentiles. I don't know how to approach this. I mainly use R as a programming tool.
2answers
40k views

### How to interpret parameters in GLM with family=Gamma

I have a question regarding parameter interpretation for a GLM with a gamma distributed dependent variable. This is what R returns for my GLM with a log-link: ...
2answers
16k views

### Interpreting a logistic regression model with multiple predictors

I performed multivariate logistic regression with the dependent variable Y being death at a nursing home within a certain period of entry and got the following ...
3answers
28k views

### Regression vs. ANOVA discrepancy (aov vs lm in R)

I was always under the impression that regression is just a more general form of ANOVA and that the results would be identical. Recently, however, I have run both a regression and an ANOVA on the same ...
1answer
50k views

### predict() Function for lmer Mixed Effects Models

The problem: I have read in other posts that predict is not available for mixed effects lmer {lme4} models in [R]. I tried ...
3answers
28k views

### Sample size calculation for mixed models

I am wondering if there are any methods for calculating sample size in mixed models? I'm using lmer in R to fit the models (I have random slopes and intercepts).
1answer
13k views

### Understanding the variance of random effects in lmer() models

I'm having trouble understanding the output of my lmer() model. It is a simple model of an outcome variable (Support) with varying State intercepts / State random ...
2answers
29k views

### Understanding the parameters inside the Negative Binomial Distribution

I was trying to fit my data into various models and figured out that the fitdistr function from library MASS of ...
1answer
70k views

### Comparing levels of factors after a GLM in R

Here is a little background about my situation: my data refer to the number of prey successfully eaten by a predator. As the number of prey is limited (25 available) in each trial, I had a column "...
1answer
26k views

### Why do the R functions 'princomp' and 'prcomp' give different eigenvalues?

You can use the decathlon dataset {FactoMineR} to reproduce this. The question is why the computed eigenvalues differ from those of the covariance matrix. Here are the eigenvalues using ...
1answer
34k views

### In R, given an output from optim with a hessian matrix, how to calculate parameter confidence intervals using the hessian matrix?

Given an output from optim with a hessian matrix, how to calculate parameter confidence intervals using the hessian matrix? ...
9answers
9k views

### Time series for count data, with counts < 20

I recently started working for a tuberculosis clinic. We meet periodically to discuss the number of TB cases we're currently treating, the number of tests administered, etc. I'd like to start ...
2answers
14k views

### Paired t-test as a special case of linear mixed-effect modeling

We know that a paired t-test is just a special case of one-way repeated-measures (or within-subject) ANOVA as well as linear mixed-effect model, which can be demonstrated with lme() function the nlme ...
1answer
41k views

### What is an acceptable value of the Calinski & Harabasz (CH) criterion?

I have done a data analysis trying to cluster longitudinal data using R and the kml package. My data contains of around 400 individual trajectories (as it is called in the paper). You can see my ...
2answers
29k views

1answer
3k views

### Remove effect of a factor on continuous proportion data using regression in R

I have a data set of continuous proportions which depend on a fixed-effect factor, e.g.: ...
1answer
15k views

### VIF for generalized linear model

Is the variance inflation factor useful for GLM models. Below example shows OLS is showing VIF>5, but GLM lower. GLM shows instability in the coefficients between train and test set. ...
2answers
1k views

### Get quantile function of dynamic mixture model

I have a dynamic mixture distribution fitted to my risk data (i.e., I have all parameters) of Weibull and Generalized Pareto, with a Cauchy CDF mixing function, that can be written as: \begin{align} ...
3answers
6k views

### Linear Regression with individual constraints in R

I am using the nnls() function from the nnls package in R to do a linear regression for regressors $x_i$ and observations $y$. ...
1answer
772 views

### Using proper scoring rule to determine class membership from logistic regression

I am using logistic regression to predict likelihood of an event occurring. Ultimately, these probabilities are put into a production environment, where we focus as much as possible on hitting our "...
3answers
1k views

### Interesting Logistic Regression Idea - Problem: Data not currently in 0/1 form. Any solutions?

I am attempting to conduct a logistic regression for a tennis analytics project, endeavoring to predict the probability of a player winning a point in which he is the server. My response variable (...
2answers
2k views

### Does this Q-Q plot indicates leptokurtic or platykurtic distribution?

The points have shown a "hump" pattern but I can't really identify that is it a narrow hump or wide hump?