# 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.

6,501 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
266 views

### How do random data eigenvalues change, as random variables are added?

I am using parallel analysis (Horn 1965) to determine how many principal components I can extract from my data. I can add more variables to my dataset, but I cannot add more cases (I know, that's ...
687 views

### Coefficients of dummy variables in multiple regression

I am struggling with interpreting coefficients from a multiple regression analysis with multiple categorical (dummy) variables. I am running a linear mixed model with biodiversity (...
240 views

### 4 specific questions about Logistic Regression with Categorical Predictors in R

I'm attempting logistic regression in R for a survey for 613 students. I'm looking to see if there is an association between my Dependent Variable (called 'BinaryShelter', coded as 0 or 1, signifying ...
570 views

### Need to extrapolate missing monthly data from annual data; the monthly/seasonal index is reasonably well-known

I have a revenue dataset for various businesses. For about half of those businesses, monthly data is available. For the other half, only annual revenue data is present. I know the seasonality of the ...
485 views

### Intepreting p values from R mediate() output

In the output below, the ACME p value shows that it is significant. But the p-value for Prop. Mediated Average is >10%. I thought Prop. Mediate is the proportion of the total effect mediated by the ...
302 views

### Compare sample means of normal distribution with autocorrelation issues

Please forgive me if this is a naive question, but I haven't been able to find an answer in my stats books or online. I'm working on a fish tracking dataset that consists of detections of tagged fish ...
564 views

### How to fit an exponential equation of the form $Y = A + Be^{CX}$ to data

I need some assistance with a nonlinear adjust. I am trying to make a mathematical model that describes the rate of silicic acid escaping from an underwater sediment. For theoretical reasons, the ...
381 views

### Sampling from Wishart distributions with scalar degrees of freedom $(\upsilon>p-1)$

Let $\upsilon$ be the degrees of freedom of a Wishart distribution and $p$ the dimensions of its scale matrix. If the degrees of freedom is a scalar, then its range is: $$\upsilon > p−1$$ and ...
114 views

### R HoltWinters - Odd dip in predictions

So, I have this time series that tracks the daily number of applications to a graduate program. Each application period is 64 days - so for each period, you start at zero and it goes up until the ...
671 views

### Quasipoisson or negative binomial glmm with differing dispersion by group

I have a set of count data, which look something like this: ...
1k views

### How to use lagged dependent variables (panel data) in practice?

Working with a panel data set with a daily time series structure I was told to include a lagged dependent variable. The dependent variable is daily electricity consumption of a medium size sample (>...
3k views

### Box cox for mixed models in R

Consider a mixed model generated using the lme function in R. How can I consider the Box-cox transformations of this model in R? I have seen similar questions being asked before but they did not give ...
340 views

### How to model a power function ($y = ax^b$) with two exponents in two regions using R and nls

I have been unsuccessfully trying to model a relationship between two measured variables described by two different power functions, on either side of a threshold. My question is how to best estimate ...
415 views

### What state-space representation of VARMA is commonly used for fitting

What state-space representation of VARMA is commonly used for fitting? Is Kalman filter + MLE approach used for fitting VARMA model as a common practice? Does the choice of which state-space ...
196 views

### Student classification with Multinomial Logit

I’m analyzing student performance data. In my dataset each row corresponds to a student and each column contains several performance metrics (continuous) and the student type (categorical, 4 types). ...
974 views

### How can I evaluate spatial autocorrelation in a binomial GLMM?

Following Dormann et al 2007 Ecography, I have employed a GLMM approach in R to account for spatial autocorrelation in a binomial regression model (logistic regression) that does not have random terms....
535 views

### How to estimate the percent of the variation of a time series explained by another time series (non-stationary)?

I've been learning about time series analysis because I want to understand how much groundwater level changes in an aquifer affect land subsidence (land sinking). I have two time series: (1) ...
529 views

### chi-squared test vs fisher's test vs … => highly unbalanced length frequency data

I would like to statistically verify if two distributions are identical. Basically, the first distribution is a length frequency distribution from a large population ("population"). The second is the ...
2k views

### VAR model for price forecasting in multiple time-series context. How to get “real figures” as forecasts?

Sorry for the rather long introduction, but since I was (legitimately) critizised for not explaining my cause and questions enough, I will do so now. I would like to conduct a (price)-forecast based ...
2k views

### How to best approach ANOVA with multiple response variables that might be correlated and Bonferroni Correction

I need some help verifying a simple analysis. I have completed a simple two factor experiment of more or less equal sample sizes. Let's assume for the case of this question that the sample sizes are ...
366 views

### Why do my boostrapped CI's (using boot.ci in R) not include the point estimate?

I'm interested in estimating an average treatment effect $$\operatorname{ATE}\left(A', A''\right) = \mathbb{E}\left( Y\ |\ A'' \right) - \mathbb{E}\left( Y\ |\ A' \right)$$ with a generalized ...
2k views

### R plm strange error when using pgmm

I have a data.frame that looks like this: ...
949 views

### How to deal with unequal sample sizes while fully embrace a dataset?

Imagine the situation: Mythical Seafolk use holes in the seabed as their burrows. Each hole has two parameters - diameter and depth. Majority of holes are unoccupied due to their surplus (n = 235). ...
1k views

### How to calculate standard errors of a non-linear model prediction?

I'm trying to understand how to show the prediction error of a model fit in R using the non-linear least squares function nls. Although there is an argument ...
787 views

### Compute Shannon entropy between every row of a large, sparse matrix

I have a sparse, binary matrix of user (rows) and items (columns). Each element of this matrix is either 0 or 1: ...
422 views

### How to fit log-linear poisson autoregressive mixed model?

I have time-series count data $N_{i,j}$ (population sizes in site $i$ and year $j$) and I want to correlate year-to-year changes with the environmental conditions $x_{i,j}$. For this, I want to fit ...
1k views

### ARIMAX for modelling daily sales

I am trying to model daily sales for a take out restaurant. They are only open on business days - no holidays or weekends - as their primary clients are office workers on their lunch breaks. Below is ...
4k views

### Backward stepwise regression with cross validation in R

I would like to do model selection using backward stepwise procedure and cross validation. https://www.otexts.org/fpp/5/3 I have used stepAIC in ...
273 views

### Can I use weights generated by robust regression in a quasipoisson glm in R?

I have response variable count data that should be treated as quasipoisson or something similar. This data also contains outliers which are important to the dataset. I cannot find an r package that ...
806 views

### Simulation for power analysis for higher order repeated measures ANOVA

I am attempting to find a way to perform a power analysis for a higher order repeated measures ANOVA where all factors are within-subjects (i.e., there are no between-subjects factors). I have looked ...
87 views

### finding position by regression fit

I try to estimate an underfloor pipe position based on a temperature distribution on a surface of the floor. I know there is the pipe emitting a hot temperature all way along. I can measure a ...
1k views

### Negative Hessian matrix in R optim

I used the optim() function in R to find the min log likelihood, however the diagonal elements of the inverse of Hessian matrix turned out to be negative. ...
115 views

### What analyses do I need to run?

Long post. Question at the bottom. My data look likes this: It consists of the test set accuracies of a series of 50 models formed on training sets. Using random sampling of the raw observations, ...
6k views

### Nested random effects group size using lme (in nlme)

I'm wrestling with a question regarding random effects that I haven't been able to figure out with my regular resources. I am examining the effects of two treatments (heat and water) on plant biomass ...
664 views

### Path analysis, sample sizes, and alternative analysis

I am examining how English ivy affects the occurrence of a salamander species under cover objects (e.g., logs). Soil moisture is assumed to be the major factor that affect their occurrence. My ...
351 views

828 views

### Mixed-effect modeling with paired observations & bounded response variables

I am quite new in the field of mixed-effect modeling. For a beginner like me, I guess I combine several levels of complication in my analysis: paired observations & bounded response variables. I ...
1k views

### Mixed-effects model for a strongly unbalanced design

I am somehow unsure on the best option to analyze these data. Here is my study case: The response variable is a morphometric measure, one for each individual. During 10 years, say 2000-2009, people ...