We’re rewarding the question askers & reputations are being recalculated! Read more.

# 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,671 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
1k views

### Stationarity tests for time series

I am currently working on time series modeling, especially on stationarity tests. For this purpose, I am extensively using Pfaff's book "Analysis of integrated and cointegrated time series with R" and ...
807 views

### Correlate bivariate Brownian bridges

Given two independently constructed Brownian bridges (from their marginal means and variances), is there a way to correlate the sample paths?
2k views

### Examples of spatial generalized linear models

I've been reading some materials on Spatial data analysis, and I've a good background in GLMs. Right now I'm looking to find an example in spatial generalized linear models, but so far I've not found ...
419 views

### Regression line envelope from Census ACS data

Context: I’m working with the Census Bureau’s American Community Survey (ACS) data which are samples (not complete enumerations) aggregated at different spatial scales. Each ACS estimate is provided ...
2k views

### What is the confidence interval calculated in a spectral density periodogram in R?

This question is similar to the one posed here: Testing significance of peaks in spectral density In that post, Pantera asks how to test whether a peak in a periodogram has a spike that is ...
659 views

### How to implement a two-stage hierarchical model of time series data in R?

I'm currently working with a data set that consists of a monthly case count for several sites, along with a number of site-specific covariates. We're trying to estimate the effect of one of them on ...
1k views

### Binomial mid-p value

I've been under the impression that the mid-$p$ values generally control the Type I error, and consequently confidence intervals based on mid-$p$ values control the coverage. However I have checked ...
4k views

### Calculate Mantel-Haenszel test in R

I would like to have a reality check of my understanding of the MH statistic. I have been trying to reproduce an example of the Mantel-Haenszel test provided in Conover (1999, p. 192-194). The data ...
2k views

### Propagation of uncertainty/standard deviations in biological experiments

I am trying to work out how to propagate standard deviations in a biological experiment, but I have some difficulties. I have the following (semi)fictitious data originating from an image analysis ...
419 views

### CIR Process-Variance reduction

I'm trying to evaluate a path dependent function, $f(r_t)$, on a Cox-Ingersoll-Ross process: $$dr_t = \theta (\mu - r_t)dt + \sigma \sqrt r_t dW_t$$ by Monte Carlo simulation. Could anyone suggest ...
91 views

### How does random variable nesting in GAMs work (mgcv)?

Consider me very new to the world of GAMs, I am actually using it out of necessity rather than by choice but I thought it could be a chance to learn something new anyway. Originally I had hoped to ...
96 views

### Is this a random or a fixed effect?

I have a question about one of the variables in my study and whether or not it should be considered a random effect. I'm conducting a study of my school's 24 general learning outcomes (or "skills".) ...
43 views

### Implementation of EM algorithm confusion

Here EM algorithm manually implemented, there's a question of the implementation in R of the EM algorithm for 2 mixed gaussians. The answer has a supposedly correct implementation. However, don't the ...
84 views

### Should I use a linear mixed model or a generalized mixed model?

I have a test dataset with repeated measures, different individuals sampled at different time points, here measured in days. I want to know if I should use a GLMM or a LMM to see how well, if at all, ...
89 views

### If the quadratic term is significant but the linear term is not, we must add the linear term to the model too?

I have a linear mixed effect model and I add the quadratic term of time in my model and it was significant and improve the AIC & BIC of the model, but the problem is that the linear term of time ...
260 views

### Intraclass correlation coefficient (ICC) for two raters using a mixed effects model for a design with repeated measurements

I want to calculate the intraclass correlation coefficient (ICC) for an inter-rater assessment with two raters. The design is as follows: Each of the $n$ subjects were assessed by the same 2 raters on ...
116 views

### Mixed-effects logistic regression

I'm new to data analysis and I'm trying to perform a mixed-effect logistic regression. My data look like this: ...
72 views

### How to infer a prior belief after observing a behavior

My participant goes through a maze made of 32 T intersections. At each intersection he must choose whether to go either to the left or to the right: one option will lead to another T intersection, ...
301 views

### Simulate/Generate Data for Multinomial Logistic regression

How to simulate data for Multinomial Logistic regression? For Example i want to generate a high dimensional data set with 90 subjects and 500 independent predictors. The ratio of Classes should given ...
179 views

### Do results from the lme-function require adjustment of p-values?

If I run a linear mixed model with the lme() function and get results like these (comparing the score of 4 treatment groups against a placebo group): ...
82 views

### 3 outcomes: one ordinal regression or two logistic regressions?

Imagine, for example, I am fitting a model with the following data: ...
236 views

### Why are the prediction error estimate and the true prediction error negatively correlated?

Section 12.2 of Computer Age Statistical Inference reports simulation results that indicate that the cross-validated estimate of the prediction error for a given prediction rule is negatively ...
350 views

### How to handle crossed and nested terms in a crossover design

Here comes my case: I conducted an experiment with the following design: 30 participants, each with a unique id, were screened and classified according to a trait. Then, all participants were tested ...
1k views

237 views

### R bayesglm: Estimates depends on order of variable

I did a logistic regression with bayesglm from package arm. I got different results depending on the order of the variables in the model: ...
351 views

### Post hoc comparison in GAM models

I'm analysing some roe deer biological traits with a gam in mgcv. One of my variable is a factor with nine levels (i.e represents a combination of litter size and sex: M, F, FF, MF and so on) and my ...