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 program in `R`.

learn more… | top users | synonyms

10
votes
0answers
374 views

Multivariant time series in R. How to find lagged correlation and build model for forecasting

I'm new in the page and pretty new in statistics and R. I'm working on a project for college with the objective of finding the correlation between rain and water flow level in rivers. Once the ...
9
votes
0answers
327 views

What are the options in proportional hazard regression model when Schoenfeld residuals are not good?

I am doing a Cox proportional hazards regression in R using coxph, which includes many variables. The Martingale residuals look great, and the Schoenfeld residuals ...
7
votes
0answers
203 views

p-value adjustment for Local Moran's I statistic (LISA)

I'm working with some exploratory spatial analysis in R using spdep package. I came across an option to adjust p-values of local indicators of spatial association (LISA) calculated using ...
7
votes
0answers
2k views

Unable to fit negative binomial regression in R (attempting to replicate published results)

Attempting to replicate the results from the recently published article, Aghion, Philippe, John Van Reenen, and Luigi Zingales. 2013. "Innovation and Institutional Ownership." American Economic ...
7
votes
0answers
1k views

How to analyze longitudinal count data: accounting for temporal autocorrelation in GLMM?

Hello statistical gurus and R programming wizards, I am interested in modeling animal captures as a function of environmental conditions and day of the year. As part of another study, I have counts ...
6
votes
0answers
194 views

Satterthwaite vs Kenward-Roger approximations for the df in mixed effects models

The lmerTest package provides an ANOVA function for linear mixed effects models with optionally Satterthwaite's (default) or Kenward-Roger's approximation of the ...
6
votes
0answers
91 views

Standard errors from flexsurvreg

I'm using the flexsurv package (in R) to fit an exponential distribution to the veteran ...
6
votes
0answers
1k views

What does the anova() command do with a lmer model object?

Hopefully this is a question that someone here can answer for me on the nature of decomposing sums of squares from a mixed-effects model fit with lmer (from the ...
6
votes
0answers
778 views

How to determine quantiles (isolines?) in a multivariate normal distribution

I'm interested in how one can calculate a quantile on a multivariate distribution. In the above picture, I have drawn the 5% and 95% quantiles on a given univariate normal distribution (left). For ...
6
votes
0answers
527 views

simple repeated measures syntax - lme vs. lmer

I'm trying to look for significant effects on "similarity" (of "isinpair" and controlling for time effects) using repeated measures with an in group sample. The intervention "isinpair" occurs after a ...
6
votes
0answers
325 views

Can these data be aggregated into a proportion for a binomial glm?

We asked 60 people to list as many restaurant franchises in Atlanta as they could. The overall list included over 70 restaurants, but we eliminated those that were mentioned by fewer than 10% of the ...
6
votes
0answers
404 views

Modeling a spline over time — design matrix and survey of approaches

A response variable y is a nonlinear function of a number of predictor variables X (in my real data the response is binomially distributed, but here I'm using a normally-distributed value for ...
6
votes
0answers
460 views

Testing for a significant difference between ML estimates: Likelihood ratio or Wald test?

I am trying to test whether or not there is a significant difference between maximum likelihood estimates of two genetic parameters (selection and dominance) across two environments with genotype data ...
6
votes
0answers
231 views

Tree size in gradient tree boosting

Gradient tree boosting as proposed by Friedman uses decision trees with J terminal nodes (=leaves) as base learners. There are a number of ways to grow a tree with ...
5
votes
0answers
115 views

Minimum sample size for a dichotomous outcome

I have two questions. I am running an experiment where I am interested in determining the sample size required for a certain CI and error, where values range between $<1$ and $>-1$. However, I ...
5
votes
0answers
72 views

Why are confidence intervals for predicted values so large?

The data for this question can be downloaded with this code: ...
5
votes
0answers
104 views

How to create a multivariate Brownian Bridge

It is known, that a standard multivariate Brownian bridge $ y(\mathbf u) $ is a centered Gaussian process with covariance function $$ \mathbb E(y(\mathbf u) y(\mathbf v)) = \prod_{j=1}^d (u_j \wedge ...
5
votes
0answers
397 views

Meaning of a convergence warning in glmer

I am using the glmer function from the lme4 package in R, and I'm using the bobyqa optimizer ...
5
votes
0answers
94 views

How can one test the assumptions of a zero-inflated negative binomial model in R?

I have fitted a zero-inflated model with a random effect using a negative binomial distribution in R, using the function glmmadmb. This is due to a large number of zeros and over dispersion. For a ...
5
votes
0answers
256 views

Failing at linear regression / prediction on a real data set

I have a data set on which I'm trying to do regression, and failing. The situation: Thousands of battle robot operators are fighting battles among each other using battle robots. Some battle robots ...
5
votes
0answers
232 views

Lasso on Negative Binomial Regression Model

Is there anyway that I can perform LASSO with Negative Binomial Regression on R? I am performing a negative binomial regression on my dataset because the data are too dispersed to impose poisson ...
5
votes
0answers
96 views

Compressed sensing: Optimization in $L_1$ norm and total variation with fourier coefficients

I'm reading the article Robust Uncertainty Principles: Exact Signal Reconstruction from Highly Incomplete Frequency Information (Candes, Romberg and Tao, 2004). In this article they are talking ...
5
votes
0answers
139 views

Structure of data and function call for recurrent event data with time-dependent variables

I'm attempting to estimate the effect of 2 drugs (drug1, drug2) on the likelihood of a patient falling (...
5
votes
0answers
56 views

Territories from observations

I have a number of animal observations, and want to deduce the number of territories (i.e. the number of individual animals) from this. More formally, the problem can be stated as follows: Each ...
5
votes
0answers
136 views

Post hoc tests for robust mixed design ANOVA using R

Is it possible to compute the function mcp2atm with unequal sample size? I ran the robust Mixed Design ANOVA by using tsplit and ...
5
votes
0answers
412 views

Which model for panel data with dependent variables from [0,1]?

I'm stuck with a regression modeling problem. I have panel data where the dependent variable is a probability. Below is an excerpt from my data. The complete panel covers more countries and years, ...
5
votes
0answers
320 views

Predicting count data with random forest

Can a Random Forest be trained to appropriately predict count data? How would this proceed? I have quite a extensive range of values so classification doesn't really make sense. If I would use ...
5
votes
0answers
470 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 ...
5
votes
0answers
367 views

The role of scale parameter in GEE

I am learning the generalized estimating equations (GEE) and the geepack R package. There are some questions that I am a little confused. In a GEE-constructed ...
5
votes
0answers
551 views

How to interpret coefficients of a multivariate mixed model in lme4 without overall intercept?

I'm trying to fit a multivariate (i.e., multiple response) mixed model in R. Aside from the ASReml-r and ...
5
votes
0answers
2k views

Choosing complexity parameter in CART

In the rpart() routine to create CART models, you specify the complexity parameter to which you want to prune your tree. I have seen two different recommendations for choosing the complexity ...
5
votes
0answers
799 views

How to compute confidence interval in ANOVA with repeated measures?

I made a model using repeated measures univariate ANOVA in R. ...
5
votes
0answers
234 views

Average Structural Function Calculation

EDIT: I have solved this problem myself. The problem with the simulation below is that the omitted variable should not be included in the 'true model'. I have written a blog post with a more detailed ...
5
votes
0answers
477 views

Asynchronous (irregular) Time Series Analysis

I am trying to analyze the lead-lag between time series of two stock prices. In regular time series analysis, we can do Cross Correlaton, VECM (Granger Causality). However how does one handle the ...
5
votes
0answers
486 views

How do I fit a nonlinear mixed effects model for repeated measures data using nlmer()?

I am trying to analyze repeated measures data and am struggling to make it work in R. My data is essentially the following, I have two treatment groups. Every ...
5
votes
0answers
234 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 ...
5
votes
0answers
577 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 ...
5
votes
0answers
381 views

Fitting a special mixed model in R - alternatives to optim()

I would like to do something in R that SAS can do using SAS's proc mixed (there is some way to do in STATA es well), namely fitting the so called Bivariate model from Reitsma et al (2005). This model ...
5
votes
0answers
330 views

Canonical correlation analysis on a MICE data set

I am looking to do a canonical correlations analysis (CCA) in R, using the CCA package, on a multiply imputed dataset (obtained from the mice package). I know that ...
5
votes
0answers
95 views

Is there an equivalent of ARMA for rank correlation?

Hi I am looking at extremely non linear data for which the ARMA/ARIMA models do not work well. Though, I see some autocorrelation, and I suspect to have better results for non linear autocorrelation. ...
4
votes
0answers
19 views

What is the “pdm” stat in the “rms” R package?

I am new to the world of Regression in statistics and I have been doing a research in which I am building an ordinal logistic regression model (ORM). In order to fit my ORM model, I am using the 'orm' ...
4
votes
0answers
37 views

How to deal with underdispersion with binomial data

I'm working with a pretty large dataset (n = 4,500) where 10% of my points (pixels in a GIS landscape) are 1s and the rest are 0s. The full model for my data looks something like this: ...
4
votes
0answers
87 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). ...
4
votes
0answers
70 views

How exactly is the sum (or mean) centering constraint for splines (also w.r.t. gam from mgcv) done?

The data-generating-process is: $y = \text{sin}\Big(x+I(d=0)\Big) + \text{sin}\Big(x+4*I(d=1)\Big) + I(d=0)z^2 + 3I(d=1)z^2 + \mathbb{N}\left(0,1\right)$ Let $x,z$ be a sequence from $-4$ to $4$ of ...
4
votes
0answers
64 views

Significance of overlap between multiple lists

I am trying to evaluate the significance of overlap between several gene lists. Here I have applied different methods to select genes relevant to a disease and I have several 4 way venn diagrams ...
4
votes
0answers
129 views

Inspecting mechanism for missing values in categorical data without prior knowledge

Scenario I am inspecting the Soybean data set, which has a quite a number of missing values for various categorical variables. Plan My plan is to eventually perform data imputation. However, ...
4
votes
0answers
149 views

Nested ANOVA: Unequal sample sizes? Variance components?

I am completely out of my depth on this, and all the reading I try to do just confuses me. I'm hoping you can explain things to me in a way that makes sense. (As always seems to be the case, "It ...
4
votes
0answers
36 views

R packages that work with biased samples

I'm working with a biased sample of web users. I'm only able to track responses of users who have navigated my site in a certain way, and I'd like to run an analysis to determine how certain factors ...
4
votes
0answers
154 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: ...
4
votes
0answers
159 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 ...