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

0
votes
0answers
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; ...
0
votes
0answers
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: ...
0
votes
0answers
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 ...
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 ...
0
votes
0answers
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 ...
0
votes
0answers
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 ...
0
votes
1answer
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: ...
1
vote
1answer
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 ...
1
vote
0answers
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 ...
4
votes
1answer
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 ...
3
votes
1answer
44 views
1
vote
0answers
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 ...
0
votes
1answer
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. ...
0
votes
1answer
43 views

adf.test vs ndiffs

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") ...
3
votes
2answers
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$} ...
1
vote
0answers
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 ...
1
vote
0answers
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: ...
0
votes
0answers
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 ...
0
votes
0answers
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 ...
3
votes
1answer
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?
1
vote
0answers
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 ...
1
vote
0answers
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 ...
1
vote
1answer
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'...
2
votes
0answers
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 ...
1
vote
0answers
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: ...
0
votes
2answers
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 ...
4
votes
0answers
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 ...
0
votes
0answers
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 ...
1
vote
1answer
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 ...
0
votes
0answers
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 ...
0
votes
0answers
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 ...
0
votes
1answer
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: ...
0
votes
0answers
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() ...
0
votes
0answers
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 ...
0
votes
1answer
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 ...
0
votes
0answers
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 ...
0
votes
0answers
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 <...
0
votes
0answers
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 ...
1
vote
1answer
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 ...
1
vote
1answer
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 ...
0
votes
0answers
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 ...
0
votes
1answer
93 views

Lagging/Leading Indicator Length Time

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 ...
0
votes
0answers
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 ...
0
votes
0answers
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 ...
3
votes
0answers
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 ...
0
votes
0answers
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 ...
1
vote
0answers
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 ...
0
votes
0answers
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 ...
0
votes
0answers
6 views

Classifier with Feedback in R

In many research talks, I have seen people talking about classifiers that accept human feedback. For example, the classifier will show you an image marked as "forest" and you can give your feedback ...
0
votes
1answer
102 views