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

learn more… | top users | synonyms

20
votes
0answers
1k views

MLEs from glmer {lme4} in R

Numerically deriving the MLEs of GLMM is difficult and, in practice, I know, we should not use the brute force optimization (e.g., using optim in a simple way). But ...
8
votes
0answers
146 views

Implementation of CoVaR (a systemic risk measure) in R

I'm trying to estimate CoVaR using bivariate DCC GARCH in R. The concept of CoVaR is the dependence adjusted of VaR, which was first introduced by Adrian and Brunnermeier (2011). However, this ...
8
votes
0answers
481 views

Understanding Singular Value Decomposition in the context of LSI

My question is generally on Singular Value Decomposition (SVD), and particularly on Latent Semantic Indexing (LSI). Say, I have $ A_{word \times document} $ that contains frequencies of 5 words for ...
8
votes
0answers
4k views

R - how to let glmnet choose lambda range when using caret?

To fit a lasso model using glmnet, you can simply do the following and glmnet will automatically calculate a reasonable range of ...
7
votes
0answers
119 views

Writing out the mathematical equation for a multilevel mixed effects model

The CV Question I'm trying to give (a) detailed and concise mathematical representation(s) of a mixed effects model. I am using the lme4 package in R. What is the ...
7
votes
0answers
366 views

Bootstrap: estimate is outside of confidence interval

I did a bootstrapping with a mixed model (several variables with interaction and one random variable). I got this result (only partial): ...
7
votes
0answers
704 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 ...
7
votes
0answers
927 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 ...
7
votes
0answers
467 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 ...
7
votes
0answers
669 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 ...
7
votes
0answers
349 views

Crossed random effects and unbalanced data

I am modeling some data where I think I have two crossed random effects. But the data set is not balanced, and I'm not sure what needs to be done to account for it. My data is a set of events. An ...
7
votes
0answers
395 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 ...
6
votes
0answers
1k views

glmer in R: Significance estimates are not robust to order of data frame

I'm using a mixed effects model with logistic link function (using lme4 version 1.1-7 in R). However, I noticed that the estimates of significance for fixed effects change depending on the order of ...
6
votes
0answers
355 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 ...
6
votes
0answers
337 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 (...
6
votes
0answers
76 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 ...
6
votes
0answers
243 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 ...
6
votes
0answers
656 views

How to generate predicted survivor curves from frailty models (using R coxph)?

I want to compute predicted survivor function for a Cox proportional hazards model with frailty terms [using survival package]. It appears that when frailty terms are in the model, the predicted ...
6
votes
0answers
2k views

How to compute confidence interval in ANOVA with repeated measures?

I made a model using repeated measures univariate ANOVA in R. ...
6
votes
0answers
335 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 ...
6
votes
0answers
566 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
565 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 ...
6
votes
0answers
120 views

Is there an equivalent of ARMA for rank correlation?

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. 1/ ...
5
votes
0answers
20 views

Autocorrelation specification in lme )

I am modeling wood properties variation of several individual within the same tree species using multilevel lme(). I specified a first model as : ...
5
votes
0answers
262 views

Interpretation of gam model results

I am fitting some generalized additive models using the mgcv package in R, and I am wanting to test between two models; whether I can remove a term or not. I am, ...
5
votes
0answers
246 views

How to fit a function to a CDF in R?

I've been given a dataframe that contains data for a CDF. The column X contains the 250 $X$ values, and the column P contains $p(...
5
votes
0answers
136 views

How to calculate log-normal distribution parameters with partial data?

Imagine we have a partial data and we know that this partial data represent only the left 5% of the log-normal distribution, which the overall data follow. How can we calculate the mean-log and sd-log ...
5
votes
0answers
73 views

Kaplan Meier estimate for data with unequal numbers in treatments

Is it possible to estimate Kaplan-Meier medians, CIs and difference with unequal sample size in treatments or do I have to do coxph? For example, in my dataset, ...
5
votes
0answers
406 views

State of the Art versions of Generalized Additive Models

Generalized Additive Models [Trevor Hastie and Robert Tibshirani 86] was well received with over 1335 Citations. I am also aware of the popular(?) version of GAM - the Multivariate Adaptive ...
5
votes
0answers
110 views

How to decide the p and q for GARCH model?

My question is simple. When shall I stop when trying the value for p and q? I have got the loglikelihood from ARCH(1) to ARCH(10). It's increasing. And then I tried GARCH(1,1), GARCH(2,1) etc. The ...
5
votes
0answers
610 views

Interpreting and reporting gamm4 result

I am new to gam, and most of my knowledge comes from this document http://www3.nd.edu/~mclark19/learn/GAMS.pdf. Now I am using generalized addictive model with random effects to model some data, where ...
5
votes
0answers
1k views

Accounting for heteroskedasticity in lme linear mixed model?

I have a data set where I measured the number of molecules (M) present in cells as a function of drug (with or without) and days of treatment (5 timepoints). I repeated the experiment 3 times, with ...
5
votes
0answers
630 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: ...
5
votes
0answers
170 views

Is the following procedure to measure the quality of an imputation ok?

I'd like to compare different kinds of imputation techniques, i.e. methods which allow to fill missing data fields in a data frame. For now, I'm only using the R package ...
5
votes
0answers
1k views

Hyper-prior for negative binomial in hierarchical model using JAGS/BUGS

Below I'm using a negative binomial because it is more flexible than a simple poisson model. The data are counts $y$ of events for 16 individuals $x$. There are 14 counts (i.e. counting periods) for ...
5
votes
0answers
485 views

Comparing ISOMAP residual variance to PCA explained variance

I am using R princomp function (from stats package) to run a PCA on a data set and I want to compare its output to that of the ...
5
votes
0answers
174 views

Variational inference engines

After doing some research on the topic, I have noticed a surprising deficit of inference packages and libraries that rely on message-passing or optimization methods for Python and R. To the best of ...
5
votes
0answers
1k 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
2k views

Fitting multilevel models to complex survey data in R

I'm looking for advice on how to analyze complex survey data with multilevel models in R. I've used the survey package to weight for unequal probabilities of ...
5
votes
0answers
159 views

What's the fundamental difference between these two regression models?

Suppose I have a bivariate responses with significant correlation. I am trying to compare the two ways to model these outcomes. One way is to model the difference between the two outcomes: $$(y_{i2}-...
5
votes
0answers
116 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
176 views

Numerical properties of the logistic growth model for non-linear regression

I am using the nls procedure in R to fit a logistic growth model. In their SSlogis function, José Pinheiro and Douglas Bates chose the formulation ...
5
votes
0answers
2k views

Interpretation of crossed random effect interactions in lme4

I'm considering a model in lme4 in which I am estimating random effects for two crossed factors, very similar to the Machines example in Bates' 2010 draft book (http://lme4.r-forge.r-project.org/lMMwR/...
5
votes
0answers
2k views

R-squared in linear model verses deviance in generalized linear model?

Here's my context for this question: From what I can tell, we cannot run an ordinary least squares regression in R when using weighted data and the survey package. ...
5
votes
0answers
811 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
305 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
1k 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 ...
5
votes
0answers
513 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 ...
5
votes
0answers
990 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
1k views

Mixed model with repeated measures and both of two treatments with lme or lmer in R

I know just enough about lme() and lmer() to get myself by with simple models, and to get myself into trouble with more complex ...