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
0answers
2 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 $$ ...
0
votes
0answers
3 views

Imputation of NAs before PCA in R

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 ...
0
votes
0answers
8 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
7 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
1answer
7 views

Locating minimum on table/output

(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
3 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
6 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
12 views

Logistic Regression: determining significance of independent variables

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(quantitive ). 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
11 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
23 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
17 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
27 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
15 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
30 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
32 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
4 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
45 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
40 views

Compare continuous variable between groups

...
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
19 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
24 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
18 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
27 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
17 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
21 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
14 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
20 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 ...
0
votes
0answers
24 views

Determine the causes of change in time with mixed models

I have a database with several continuous variables measured in two times. I searched for a change in time in my dependent variables in this way: ...
0
votes
0answers
54 views

Small loadings in all variables, PCA analysis is ok?

I'm performing a PCA analysis on a set of 5 variables, whose correlation matrix is: ...
0
votes
0answers
21 views

How to interpret ANOVA output comparing two models

I'm working with the Blackmoor data from the study "Female adolescents with anorexia nervosa and their parents." I've made 4 models based on this: ...
0
votes
0answers
33 views

Using principal components to perform further PCA

I am working with principal component analysis for the first time. I have managed to extract the principal components of one set of data (say data1) using prcomp(). ...
0
votes
0answers
4 views

How to use filter in dplyr to find values in muliple columns without using '|' [migrated]

I want to use the 'dplyr' package in order to return rows in a data frame that contain some numeric or character values in any of the columns. For example, ...
0
votes
0answers
21 views

verify the central limit theorem of chi sq distribution

hi i have a question on verifying the central limit theorem using R. the question was to use data generated from different statistical distribution n see if the sample means follow normal ...
0
votes
0answers
6 views

Frequency form to case form - unexpected values in table [migrated]

I'm taking count data on voting preferences by race and entering it into a table in frequency form, then expanding out to case form and using CrossTable to look at ...
2
votes
1answer
61 views

Finding peaks in power spectrum of a signal in R

I am analyzing some eeg waveforms and developing a classifier based on them. In the data I have, I usually find a strong peak at a very low frequency (I am not interested in this peak) followed by ...
0
votes
2answers
53 views

weibull mle with optim in R

I am fitting a weibull distribution to some data. Let us say we have the data in warpbreaks, that is, warpbreaks$breaks in R. My code is as follows: ...
0
votes
1answer
23 views

Can C4.5 handle continuous attributes?

I'm trying to play with the breast cancer data available through UCI: https://archive.ics.uci.edu/ml/machine-learning-databases/breast-cancer-wisconsin/wdbc.data When trying to classify the data ...
2
votes
1answer
56 views

One observation per level in mixed-effect model

Field explains how to analyse repeated-measures data using linear mixed-effect models (LME). See Field et al., Discovering Statistics Using R, 2012, p. 573. However, the way he specifies the model, ...
0
votes
0answers
20 views

Boxplots with percentiles instead of hinges [duplicate]

I am new to R and am working with a dataset refined of 254 datapoints that are in 12 different groups and would like to compare the parameters with boxplots between ...
-3
votes
1answer
74 views

Bayesian Data Analysis [on hold]

I started recently studying the Bayesian Data Analysis. I installed R studio, BEST and JAGS. I ran this analysis on two groups of means (...
0
votes
0answers
14 views

Gibbs Sampling form Non-standard distribution in R

Gibbs sampling examples in R has involved initializing and updating iteratively from conditional that are in standard form. Has anyone performed on a gibbs sampling when the conditionals are in ...
1
vote
1answer
56 views

Box plot with just two values does not have its whiskers in R

Are boxplots by default unable to produce the whiskers when there are just 2 values being input? I am working with dataset rufi and the values input are ...
0
votes
0answers
17 views

GAM and ordered probit regression in R

I want to check the fit of the ordinal probit regression model with the help of GAM (generalized additive models). There are plenty of examples how to construct GAM for dichotomous responses in R. ...