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

7,504 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4
votes
0answers
3k views

How does the sim() function in the arm package determine non-informative priors?

The arm package includes the sim() function. On its R help page it states: ...
4
votes
0answers
245 views

How can IRT-Models be understood in GLM/ SEM Framework? (Predict Learning with added Paradata-Covariates)

I'll be working with data from an intelligent tutor system similar to one studied in the KDD-Cup 2010 on student performance prediction and plan to use IRT models to infer item and ability parameters. ...
4
votes
0answers
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 ...
4
votes
0answers
875 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
1k views

Get canonical loadings (i.e. scores) from weights in r package PMA

I want to perform regularized canonical correlation between two matrices with more variables than observations (same subjects), one of which is very large (~18000 columns). The only r package that ...
4
votes
0answers
485 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 ...
4
votes
0answers
428 views

Maximam r distance for Ripley's K-function

I am using R's package spatstat to study the locational pattern of conflict events in Africa (around 8.000 points) using point pattern analysis techniques. I was able to obtain the plot of $g(r)$, ...
4
votes
0answers
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 ...
4
votes
0answers
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 ...
4
votes
0answers
297 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 ...
4
votes
0answers
1k views

How does the RMS package's nomogram calculate points for continuous variables?

I have been reading a number of papers where researchers have created risk scores based on logistic regression models. Often they refer to "Sullivan's method" but I have no access to this paper and ...
4
votes
0answers
887 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 ...
4
votes
0answers
90 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 ...
4
votes
0answers
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, ...
4
votes
0answers
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 ...
4
votes
0answers
2k views

Can I use an automated model selection approach on an lmer object?

I am attempting to use MuMIn to run a model selection analysis on a mixed model fitted using lme4. Because this model is fit ...
4
votes
0answers
373 views

On nonlinear regression, fits, and transformations

I am trying to fit a nonlinear regression model in R using nls(). I have a form of the equation I want to fit to: $$y = (a \times x_{1}^c +b \times x_{2}^d) (x_{3}^...
4
votes
0answers
2k views

Adjusted / marginal means estimation in linear mixed effect model in R / Stata

I am a new R user, having some difficulties validating/replicating results from Stata (which a colleague uses) in R. We are investigating the time (TIME<-c(1:7))...
4
votes
0answers
1k views

mixed effect model for method comparison of time series of paired measurements

A coworker and I are trying to analyze agreement between two measurement methods. I apologize in advance for needing some extra explanation due to the fact I'm an engineer whose statistics background ...
4
votes
0answers
4k views

Weights argument in glmer() when predicting proportion data: why is it needed when all weights are around the same?

What do the weights argument in glmer refer to? I used sample sizes as weights with ...
4
votes
0answers
2k views

How to interpret output of CVlm() in R?

I am using 10 fold cross validation using the CVlm() function from the DAAG package. This is part of the result shown: ...
4
votes
0answers
997 views

How to write a mathematical equation for GLM model with gamma and gaussian distribution?

I am writing a paper and the following is a code that I wrote in R. The reason that I am struggling with this is because I tried hundreds of models with different variables and the following model ...
4
votes
0answers
634 views

Obtaining predicted probabilities that include multiple random effects from mixed effects model

I'm running a mixed effects logit model with a binary response variable. The data are cross-national survey data, over multiple waves (i.e., World Values Survey). As such, the random effects specified ...
4
votes
0answers
969 views

How to test stability/variability of statistic over time, using R

I have a long time series data (running several years). I have split the data into several series, each of 1 month duration. I then perform some custom calculations on each of the 'shortened' time ...
4
votes
0answers
9k views

Fitting a zero-inflated negative binomial regression with R

In this thread, I laid out a problem involving fitting a model that attempts to use minor league baseball statistics to predict success at the major league level (explained in full in the thread). ...
4
votes
0answers
5k views

Getting the bootstrap-validated AUC in R

In a paper by Faraklas et al, the researchers create a Necrotizing Soft-Tissue Infection Mortality Risk Calculator. They use logistic regression to create a model with mortality from necrotizing soft-...
4
votes
0answers
181 views

Which variables are driving correlations within groups

I'm running an analysis on a few data sets that each typically have 100-200 cases measured across 120-160 variables - something similar to looking at gene expressions. Each variable is a non-centered ...
4
votes
0answers
2k views

SVM classifier (with soft-margin) implementation in R, gamma value and quadprog

I'm trying to implement a Support Vector Machine classifier in R and I have to solve the optimization problem using the quadprog R package which solves problems of the form : $$min_b \frac{1}{2} b^...
4
votes
0answers
862 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 ...
4
votes
0answers
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 ...
4
votes
0answers
2k views

How to do a multiple regression with ARIMA using R?

I am analyzing some tree physiology data (transpiration) in relation to a number of environmental variables (many of which are predictors such as temperature, PAR and vapour pressure deficit). I ...
4
votes
0answers
1k views

Finite mixture models with bounded data

I am trying to fit a finite mixture model to a dependent variable which is bounded (practically) between -0.594 and 1 (theoretically, the latent variable is bounded between -Inf - 1). The data are ...
4
votes
0answers
282 views

Residual from Functional Demographic model for fertility

I'm trying to fit a functional demographic model (fdm) to fertility rates using the demography package in R. When I've plotted ...
4
votes
0answers
2k views

When using repeated-measures ANOVA in R, what does it mean to specify Error(subject) instead of Error(subject/(A*B))?

For a two-way repeated measures design, we can specify the model using aov in the following fashion: ...
4
votes
0answers
1k views

Computing Cronbach's Alpha and Intraclass Correlation coefficient from an lmer model

I am trying to calculate the Intraclass Correlation for a rater study using R and the library lme4 and the function lmer. The data has the following design: The same 6 raters (at least 4) are rating ...
4
votes
0answers
978 views

Cox proportional hazards with time-dependent covariates: predict in R

I would like to use the predict function (or something similar) in R to generate expected values from a Cox proportional hazards model with time-dependent covariates. The model takes the form ...
4
votes
0answers
214 views

Using taxonomic levels as factors in random forests: does it make sense? Is it needed?

I want to test the effect of a set of predictors (ecological and morphological factors) on a categorical response variable (an animal behaviour). As far as I've read, random forests do not make ...
4
votes
0answers
671 views

Kernel in PenalizedSVM R package

There is not option to select kernel in penalizedSVM R package. What kernel do they use? Is there some other R package with penalized SVM methods where I can choose various kernels?
4
votes
0answers
864 views

Testing for mediation using LMER and a Freedman and Schatzkin's method (in R)

I'm trying to analyse, whether the effect of answer correctness ($X$, binary) on confidence ratings ($Y$, continuous) in some psychological task is mediated by another rating ($M$, continuous). In ...
4
votes
0answers
2k views

Strange pattern in residual plot from mixed effect model

I've run a mixed effect model in R by using lme. The explanatory (Temp_Diff & Distance) and responsive (LF_Diff) factors are continued variables. ...
4
votes
0answers
147 views

How to perform exploratory factor analysis on associative network?

In an article by Teichert and Schontag ("Exploring Consumer Knowledge Structure Using Associative Network Analysis", 2010), the authors perform (page 387) an exploratory factor analysis (EFA) on an ...
4
votes
0answers
559 views

How do you show explained variation in cforest?

I'm trying to run a cforest model in R with continuous and categorical variables. When I tried this in randomForest, the ...
4
votes
0answers
6k views

Test for effects of two categorical variables on a binary response variable?

I am looking for a test similar to a 2-way ANOVA that would work on a binary response variable. My response variable is survival of plant seedlings (alive or dead). My explanatory variables are ...
4
votes
0answers
8k views

How to diagnose multicollinearity using the output of vif function in R?

I am running a logistic regression in R and am attempting to determine if multicollinearity is a problem with my model. When I run vif() on my final model, I get <...
4
votes
0answers
238 views

Repeated measures interaction betwen SNP and treatment with R

This is my first question is this forum. I have the a problem that I want to solve with the lme function of the nlme package of <...
4
votes
0answers
183 views

What is the canonical example which show advantage of robust linear regression over LS linear regression?

What is the canonical example which show situation when robust linear regression has advantage over least square linear regression ? I was trying to simulate situation when some errors (20% of them) ...
4
votes
0answers
1k views

lmPerm p-values and multiple testing

I've started using lmPerm in order to perform regressions in R. The equation I want to fit has the form: ...
4
votes
0answers
3k views

What is the correct way to calculate the explained variance of each EOF as calculated from a gappy data set?

I am trying to determine the correct amount of variance explained by each mode of an Empirical Orthogonal Function (EOF) analysis (similar to "PCA") as applied to a gappy data set. (i.e., containing ...
4
votes
0answers
839 views

Efficient Portfolio Optimization Through Simulation

Apologies in advance for the (possibly?) poor terminology as I'm a bit of a novice in the field. I was torn whether to ask this on stackoverflow or here, so hope its the right place. Anyway, my ...
4
votes
0answers
2k views

Toeplitz variance matrix with nlme

I would like to specify a Toeplitz variance matrix for the random effects of my nlme model in R. Is it possible ? More precisely,...

1
4 5
6
7 8
151