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

0
votes
1answer
9 views

How to cluster data with repeated measurements?

Most clustering algorithms assume that data points in each row are independent. I have some data with repeated measurements from individuals. I can use a standard algorithm, and then check to see if ...
1
vote
0answers
13 views

Glmnet Caret Package with small number of observations

I have a regression problem where I’m attempting to train a data set with 70 predictors, but only 35 observations with glmnet in the caret package. I’m trying to determine the best resampling method. ...
1
vote
1answer
35 views

Removing collinear variables for LDA/QDA in R

I'm new to R and I've been searching for a while for a function which can reduce the number of explanatory variables in my lda function (linear discriminant analysis). Basically, I've loaded the ...
4
votes
1answer
162 views

Why does this logistic GAM fit so poorly?

I am trying to create a logistic regression model with mgcv::gam with what I think is a simple decision boundary, but the model I build performs very poorly. A local regression model built using ...
0
votes
2answers
31 views

Density plot narrow peaks and mean far away from peaks

I am trying to understand a density plot. It has narrow peaks and means are far away from the peaks. What would be the reason for such behavior? Should I be doing a different plot to understand this ...
0
votes
0answers
20 views

non-parametric tests with significant difference in sample sizes

I have outcomes from a biological expt., where we have measured DNA lengths that has been affected. For condition1, I have 11 observations (length of DNA) and for condition2 I have approx. 116000. I ...
3
votes
1answer
26 views

Multivariate hypergeometric distribution in R

Say I have a bag of colored marbles. This bag contains 30 marbles, 2 of which are red, 3 are green and the rest are blue. I am now randomly drawing 5 marbles out of this bag, without replacement. I ...
0
votes
0answers
12 views

Comparison of two correlation matrix of same dimension in R [duplicate]

I have two correlation matrices(Pearson).For example, metrices of (3 gene X 3 gene) for cancer samples and normal samples,individually. I have got gene-gene correlation for both sample. Now I want to ...
0
votes
1answer
19 views

Count the number of each unique row in a data frame? [on hold]

Suppose I have a data frame such like: ...
1
vote
0answers
2 views

Why does glmnet in caret give different predictions for different alphas even though lambda is zero?

In R, when using caret to train an elastic net regularization model, I find that different values of alpha give different predictions when the lambda parameter equals zero. This should not be the ...
3
votes
0answers
22 views

Solving non-linear equations in R with optimal inital values

I am using the rootSolve package in R to estimate parameters of non-linear equations. The basic formula is ...
0
votes
0answers
28 views

SVM accuracy evaluation

Could you please answer some of my questiona regarding SVM-RFE (svm with recursive feature elimination). I am using SVM-RFE with linear kernel for the binary classification and feature selection ...
-2
votes
0answers
29 views

why cannot we find an arima model for the daily forecast of a dataset with more than 2 years of historical data?

I faced this problem a few times. I used TBATS to fit a model to the daily forecast of a variable and then wanted to include other regressors to my forecast. So I used auto.arima. all of my databases ...
0
votes
0answers
8 views

Select the cases from a data.frame that have been used in a GLMM [migrated]

I am trying to see differences in the feeding-rate of one bird species between big forest patches and small ones. I have several forest patches of both sizes, and three years of study. Some ...
0
votes
0answers
20 views

How to solve hat check problem using R? [on hold]

Suppose n people go to a fancy restaurant. Each person is wearing a hat and checks his/her hat at the door as he/she arrives. The hat-check attendant gets tipsy throughout the evening, forgetting ...
0
votes
1answer
48 views

Using MySQL or r, or both?

I have a large dataset and I want to do statistical analysis on certain subsets of the data. At the moment I see this as a two step procedure: Import data into a MySQL database and use the world ...
0
votes
1answer
31 views

sum of correlated random sample

Suppose I have 1000 draws each of two random variables X and Y. If I wanted to sample the sum of these variables, I would simply calculate 1000 samples, i.e. $$ S_{i}=X_{i}+Y_{i}, i=1,2,…,1000 $$ ...
2
votes
0answers
35 views

Imputation of missing values for doing PCA in R [duplicate]

I have a dataset with approximately 4000 rows and 150 columns. I want to predict the values of a single column (= target). The data is on cities (demography, social, economic, ... indicators). A lot ...
1
vote
0answers
30 views

multiplicative model in r

I have to estimate a model forecasting the sales (as stock units) for AXE deoderants.I want to apply the multiplier specification on this model. The model should look like this: log(Sales) = b0 + ...
0
votes
0answers
18 views

Trying to understand the basics of a mixed-effects logistic regression model for a 10-step continuum

I am trying understand how to correctly build a mixed-effects logistic regression model in R. I believe my model is pretty simple and straight forward but I'm lacking in experience and uncertain I'm ...
0
votes
0answers
14 views

Locating minimum on table/output [migrated]

(R studio) Hi, Basic question about how to go about finding the minimum of a value on a table. The table is longer than this (nsplit goes to 1532), which is why I'm looking for a search function. ...
0
votes
0answers
5 views

pggls function in R - weird results

I need to estimate a panel model. I have run the "normal" fixed effects model using plm in R and also wfe. I also wanted to try pggls considering its tolerance of heteroskedasticity and ...
0
votes
0answers
9 views

Value function iteration in R [on hold]

Is there any package in R for value function iteration? Matlab is the weapon of choice for this, but I am an R user. I read the vignettes of many packages, but could not find anything that could help ...
0
votes
0answers
44 views

Logistic Regression: determining significance of independent variables [on hold]

I am trying to do Logistic Regression in R. My data set contains more than 50 variables. Some of them are factor (qualitative variable) and others are independent variable(quantitative). I would like ...
0
votes
0answers
24 views

R code to determine peakedness of a maximum [migrated]

Given input vector $x$, let the maximum of $x$ occur at index $i$ in the input vector. I am trying to quantify the peakedness of this maximum and do that I have thought of determining following ...
0
votes
0answers
16 views

Convergence warnings in glmer

I am running a Generalized Linear Mixed Model in R 3.0.2 using lme4 1.1-7 for a dichotomous outcome variable (success, 0 = no, 1 = yes) ...
1
vote
0answers
32 views

Linear model / models analysis

Above are three plots of the Linear model I am trying to analyze. The first one is a basic plot of the linear data: ...
0
votes
0answers
20 views

Mixed effects structure: Main effects in random slopes with between-subjects design

My question is about whether it is appropriate to include certain random slopes in a mixed effects model with a between-subjects design. This is my first question on this stack exchange, and I'm ...
1
vote
1answer
18 views

How to assess the functional form of covariates in the Cox model with martingale residuals in R?

I want to find if the functional forms of covariates in my Cox model are linear. I understand the way to do this is to plot the Martingale residuals against the covariate of interest. I have found ...
0
votes
0answers
5 views
0
votes
0answers
28 views

I get unusual (wrong) results when plotting regressions with log10 axes compared to linear axes [on hold]

When plotting a datasets of values and then using linear regression I get different (unexpected and seemingly wrong) results when plotting using log10 on both axes. Can someone please help. OK code ...
0
votes
0answers
16 views

Better calculation of ends of the curve when using R's RandomForest?

I've been using R's randomforest library to predict a series of (2000) products with prices ($10-$2000) and I'm noticing the low and high ends of the continuum are least accurate, especially when I ...
2
votes
1answer
35 views

Standardized coefficients for linear models with numeric and factor variables in multiple linear regression using scale() function in R

I have on question regarding standardized coefficients (beta) in linear models. I have already asked one question here. From the answers I assume that I should use R's ...
0
votes
0answers
35 views

lotto simulation with R [on hold]

What is the simplest way to make a lotto simulator. Lets assume that I bought 10 different combinations ( 7 out of 39). So how to calculate the expected value of winning if for 4,5,6,7 correct ...
0
votes
0answers
6 views

klaR package and the stepclass function

(R studio) Hi, I'm running LDA on a dataset with 250,000 observations, 2 classes and 30 variables. My goal is to create a classification model using the LDA function. After loading my variables I ...
3
votes
0answers
47 views

How to best approach ANOVA with multiple response variables that might be correlated and Bonferroni Correction

I need some help verifying a simple analysis. I have completed a simple two factor experiment of more or less equal sample sizes. Let's assume for the case of this question that the sample sizes are ...
0
votes
2answers
58 views
0
votes
0answers
3 views

R: coherency matrix returned by spectrum is always 1

I am trying to understand what the coh value obtained from a call to spectrum means. I created a random 20x4 matrix and called spectrum on it. The ...
0
votes
0answers
21 views

Reading in data set [on hold]

I am trying to read in this data set using R http://statweb.stanford.edu/~tibs/ElemStatLearn/datasets/nci.data I've tried several different things. Can anyone help me out?
0
votes
1answer
25 views

How to solve nonlinear optimization problem in R

Suppose I have a set of data and reason to believe the following relation holds y ~ a0 + a1*x1 + a2*x2 + a3*log(x3) How can I use R to solve for the coefficients {a0, ... a3}, supposing I want to ...
0
votes
0answers
19 views

Regarding Nested Anova in R

I would just like to double check if my approach to the following analysis was correct. Based on my design I have two treatments (A and B) with treatment A being comprised of 5 populations and B of 3 ...
2
votes
0answers
29 views

“Frequency” value for seconds/minutes intervals data in R

I'm using R(3.1.1), and ARIMA models for forecasting. I would like to know what should be the "frequency" parameter, which is assigned in the ts() function, if im ...
0
votes
0answers
3 views

extract data.frame() from group_by() [migrated]

I'd like extract a data.frame produce by group_by() function of the dplyr package on R. My original data looks like this: ...
0
votes
0answers
18 views

Selecting the right BIC value

I'm using the hddc for an assignment to find the optimal number of clusters. The dataset is 9-dimensional and consists of 200.000 rows, however, the BIC values that I'm getting are really high. How ...
0
votes
0answers
22 views

mixed effect regression model

I would like to expand over a previous question of mine (What is the correct model for this experiment design?), with slight modifications... To set up the scene : We have a completely randomized ...
0
votes
0answers
17 views

Generate observations from an autoregressive process [on hold]

I'm wondering how I could go about generating data from an AR process, for example: $$y_t=0.2+0.5y_{t-1} +e_t$$ where $e_t\sim N(0,1)$ with $y_1=0.2$ I need to generate 100 observations from ...
0
votes
0answers
27 views

Multivariate regression with categorical response variables

Explanation of Data: I started with a data set where each user belong a specific group and their contribution to different domains. After multiple pivots and pre-processing attempts, I got my data in ...
0
votes
0answers
19 views

How to enter data into contingency table directly?

I'd like to create a contingency table. I do it using: matr=matrix(c(62,61,36,19,10,21,58,60,39,22,12,19,91,83,72,23,52,62,43,28,59,57,29,20,12),5,5) but it ...
0
votes
0answers
16 views

Heavy-tailed RBF kernel function

I'm trying to run a SVM regression on some data and I want to use ksvm from kernlab or svm ...
0
votes
0answers
22 views

Phylogenetic General Least Squares, Multivariate Regression

I'm working on a biological question, with species data derived from an external database, which has multiple response and predictor variables. As a result, I want to do multivariate regression across ...