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 program in `R`.

learn more… | top users | synonyms

2
votes
2answers
96 views

Which is correct way for regression line?

I have a set of data (some Frequencies per month, Var1 is the month): ...
0
votes
0answers
16 views

What does the intercept correspond in the Anova() function in R?

I've been struggling to understand what the intercept sums of squares and p-value correspond to when I run a one-way ANOVA with Type "III" sums of squares using the Anova() function in the car ...
1
vote
1answer
56 views

Interpreting a linear mixed effect model's interaction term

I am a biologist and am attempting to analyze the effects of time and location on depth. I was told I needed to use a mixed effects model to account for the random variables of Individual and tracking ...
1
vote
0answers
22 views

Fitting a model to data for prediction - best choice for data

I have some data I need to fit a model to that can be used for prediction (interpolation). The data is summarized by the plot below. The black line is x=y. I want to be able to fit a model so as I ...
0
votes
0answers
8 views

How to properly renderDataTable in Shiny when theres is whitespace in the column headers [migrated]

I am rendering a DataTable from a data.frame to which I've given names like "Agent Name" for readability's sake. When I deply a shiny app to view this data as a DataTable, the whitespace in the column ...
2
votes
0answers
44 views

Looking for and dealing with collinearity in a GLM

I've got this dataset with one continuous dependent variable and two categorical explanatory variables. I'm wanting to run glms on the data but I'm finding problems with what I think is collinearity. ...
0
votes
1answer
12 views

Multivariate Regression on Multicollinear Categorical Variables

I am working on a dataset with a continuous response (which could be dichotomized), one continuous covariate, and multiple categorical variables. The continuous covariate (weight) is directly ...
0
votes
1answer
22 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
1answer
39 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
43 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
218 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
57 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
27 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
44 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
13 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
28 views

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

Suppose I have a data frame such like: ...
2
votes
0answers
25 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
27 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 ...
-2
votes
0answers
35 views

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

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
25 views

How to solve hat check problem using R? [closed]

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
0answers
52 views

Using MySQL or r, or both? [migrated]

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
42 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
40 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
33 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
30 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
6 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 [closed]

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
49 views

Logistic Regression: determining significance of independent variables [closed]

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
24 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
41 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
28 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
26 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
18 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
44 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
9 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
75 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
62 views
0
votes
0answers
5 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
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
24 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
32 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
24 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
31 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
21 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 ...