# Tagged Questions

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.

9 views

### R Network - Color-code the nodes based on a separate vector [migrated]

I have a matrix B and a vector A (the matrix has value 0 or 1; the vector has value from 0 to 1 continuously; ...
16 views

### what is the meaning of covariates in ComBat

Can anyone tell me what the difference between the following code1 and code2 is? code1: ...
4 views

### Reverse the scale of the x axis in a plot [migrated]

I have created a plot in R and my own custom x and y axes. I would like the x axis to be displayed in a reverse order (1-0 by -.02). I have read numerous posts and threads that suggest using xlim and ...
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 ...
16 views

### State space modelling of longitudinal data in r

I have n stations, and for each station there are m time series observations on different days, each of length ...
12 views

### Alter X axis labels on ROC curve [migrated]

I have performed a logistic regression and have plotted a ROC curve in R. I would like to alter the x and y axis labels however, am having trouble doing so. I have managed to suppress the previous ...
3 views

### Do proximity or importance influence predictions by a random forest?

Does proximity or importance influence in prediction quality in random forests? Or are they just information about the model? Setting them to True does increase accuracy? Does this model: ...
61 views

### Find best parameter values: minimise some while maximizing others (in R)?

I have several variables (A, B, C) which are independent statistical measures. Each of these vary for different values of my function's parameter X. The plots of A,B,C look something like this: I ...
12 views

### Factor analysis without listwise deletion

Can factor analysis be done in a manner which affords missingness on some items? With what methods can a factor analysis be performed in which subjects who are missing on one or two items are ...
53 views

### Change Score Model in lavaan

UPDATE: I think I was over-complicating my problem and am struggling through a new approach as described here: paired t-test as a simple latent change score model I am still accepting the answer ...
44 views

### How do the number of imputations & the maximum iterations affect accuracy in multiple imputation?

The help page for MICE defines the function as: ...
15 views

### Discrete state space sampeled from a symmetric proposal distribution (monte carlo sampling) in R

I am new to MCMC, but proficient in R. I want to draw Markov chain Monte Carlo samples for the following scenario: The state space consists of all combinations of ...
27 views

### maximum of a function from proportions using optim() in R

I would like to receive the maximum of a function f(x) where the x are proportions that sum to one. ...
43 views

I have a really small time series dataset (21 yearly observations) and I want to check if my data is stationary. ndiffs(TS, test="adf") ...
92 views

### Constrained optimization in R

My data is categorized by two different parameters (say F having n groups and S having m groups) and I want to get a relationship between the two. For example $F =${$f_1 , f_2 , f_3$} = {$10,10,5$} ...
26 views

### Power analysis using lmer mixed model

I am using a mixed model in lmer to analyse some phenotype data across 3 levels of a treatment I am interested in, blocked by a random factor I am not interested in (just want to control for). So my ...
16 views

### How to calculate VPC in glmer?

For a specific analysis I want to calculate the variance partition coefficient (VPC). I am using the following formula: ...
32 views

### Is there a spatial gradient in my data

I have a grid with densities of one animal and would like to find out if there is a spatial gradient in relation to density (i.e. is density increasing/decreasing from north to south oer else). So I ...
13 views

### Mahalanobis Function with test and train data

I am new to R programming. I was given a task at work with minimal explaination. I have a huge Data set. Can someone explain the use of Test data and train data? How to use that along with a ...
75 views

### Does JAGS have an R front end like brms for Stan? [closed]

Does JAGS have an R front end like brms / rstanarm for Stan? Is anyone working on one for JAGS?
47 views

### Find predictive power through different score combinations

My situation is a bit too complex for me, given I'm a newbie in R and analysis. I have roughly nine different score types, each of which was a model itself built upon various variables for each score ...
21 views

### How to convert standardized line graphs into a function?

I have graphed revenues from 4 different products of the same variety (ie. four different movies and the revenues they brought in). The axes are: x is the weeks and y is the revenues; with the lines ...
26 views

### How to differentiate two distinct linear populations with clustering in R

I am new to clustering. My apology if this has been asked before. I'd like to differentiate two distinct linear populations within sample matrix, and tag them differently. Apparently k-means couldn'...
63 views

### Poisson Modeling ANOVA

I'm looking to model percent change in transaction year over year for sales people grouped in certain categories (7 categories total). The percent change in transactions would be Q1 of the current ...
12 views

### How to perform a MANCOVA in R

I have been looking around and cannot figure out how to perform a Mancova in R. independent variable: cluster number dependent variables (multivariate): body shape (19 partial warp scores) covariate: ...
58 views

### adjusting random forest outputs built from 50:50 sample back to balance of total population

I'm using a random forest in R (randomForest) to predict a binary output (1,0) for a dataset that is heavily unbalanced. In this example let's assume the population has 1% 1's and 99% 0's. Building ...
41 views

### Markov Chain Monte Carlo (MCMC): How many samples are needed to get a uniform sample?

I am interested in a general answer although my question is rooted in a specific document. I am using the R package "hitandrun": https://cran.r-project.org/web/packages/hitandrun/hitandrun.pdf On ...
31 views

### Classification technique for unsupervised data?

I have unsupervised data it is a mix of continuous and categorical data. Now I want to classify the test data into three categories on basis of my unsupervised data. The approach I took is first do ...
24 views

### Evaluating intervention statistics for a given observation

My desired procedure is the following: A time series is imported. One or more observations are flagged as events/outliers. An automated procedure determines what type of outlier each event is and ...
22 views

### Combining collaborative filtering and market basket analysis for effective recommendation

I am working on a store data set and I am trying to figure out ways to come up with more effective recommendations based on Market basket analysis and Collaborative filtering methods. Is it possible ...
9 views

### Robust MM regression did not fit well and followed the pattern of first predictor

I have been using the rlm (MM estimator) command form the MASS package in R. Unfortunately the pattern of fit.model followed the ...
31 views

### ARIMA:-Inf in MAPE and MPE

I am trying to find the forecast accuracy for my ARIMA model. When I use summary(fit) code, I get MPE as -Inf and MAPE as Inf: ...
14 views

### Paired T-test vs. Survey Design T-Test with Stratification

What is the difference between survey design based approaches to t-tests when there is a stratified sample and paired t-tests where the pairs are the strata? For example, in R there is a svyttest() ...
17 views

### Statistics, R: Build linear regression model with differently contrast-coded variables

I want to build a linear regression model where I predict a mean of a group of participants (how they rate something on average). Predictors should be age (continuous) origin (deviation coded, each ...
37 views

### Cross validation function from which programming language is more appropriate? [closed]

I'd like to use resample to achieve stable results of an unsupervised algorithm that finds clusters in data. I'll use k-fold cross validation repeated many times but I'm in doubt if I should use R or ...
31 views

### Can I flip the null and alternative hypotheses for logit regression in R?

I would like to accept the hypothesis that a variable is insignificant in determining the dependent variable of a logistic regression, but in R the glm summary which contains the p-values for each ...
19 views

### Rsquared / R2 (i.e. R²) for Gamma-GLMM?

I have successfully calculated R²c as a goodness-of-fit measure for GLMM's using the r.squaredGLMM function implemented in R's <...
22 views

### How to select the number of basis functions in functional data analysis? [closed]

In functional data analysis, I could not understand how to select the number of basis functions for a particular data. I followed the paper, where it is mentioned that there is no thumb rule to select ...
4 views

### R- is it safe to use the package sandwich for instrumental variable or GMM models?

Both of the following approaches should lead to the same results in my opinion. This is a modified example from ?ivreg where I wanted to use ...
34 views

### Is it possible to create a SURFACE PLOT with this dataset?

I am new at software programming and I am starting to program some 3D graphs. I have this dataset ...
30 views

### Optimization depending on initial start values

I'm running a maximum likelihood of a logit regression, but the estimated parameters value and the loglikelihood value are depending on the value of the algorithm's start. For example, if my start is ...
93 views

I tried looking this question up on google and didn't find material that answered my question. But my questions are: (1) Is there a method to determine how long it takes a leading indicator to ...
6 views

### plot graphics result for example association rules via “aruleViz” from java code using Rserve [migrated]

I have written an R function, that connect to database, fetch some records, obtain association rule of the object via arules library and plot the rules using ...
29 views

### Add new column to DataFrame inside a fuction [migrated]

I have a dataframe (called train) that contains a YOB (year of birth) column. I'd like to compute the ...
74 views

### Single Sample t-test Hypothesis Confusion

In case you want data set.seed(100) hotel <- rep(1,100) hotel <- unlist(lapply(hotel, function(x) { runif(1,1,5) } )) NULL Hypothesis :- Hotel rating is ...
27 views

### Intercept of nearly zero, how to interpret? [closed]

What does it mean when you have a very low intercept e.g. 0.007466004 in regression model with a balanced group for a binary dependent variable. Does it mean the ...
44 views

### Multivariate regression in Tensorflow where dependent variables also depend on each other

Dear Stackoverflow community, I would like to understand how to implement a multivariate regression in Tensorflow, where all the dependent variables yn depend on both input variables xn as well as ...
28 views

### What regression to use when dependent variable has cutoffs? [duplicate]

Suppose that my dependent variable has hard cutoffs in the sense that it is physically impossible to obtain values outside of a certain range. (If it matters, the dependent variable is a percentage ...