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

Testing variability in chromosome numbers at different taxnonomic levels?

Suppose I have a data set listing the chromosome count of a large number of species. Each species, in addition to chromosome count, have data on their Phylum, Order, and Family. I would like to know ...
0
votes
0answers
19 views

Code for type=“h” in ggplot2 [migrated]

This may sound really simple but I'm trying to find the equivalent code to plot(x,y, type="h") as a qplot code. I already have: ...
0
votes
0answers
15 views

Stock Closing price forecasting using ARIMA Model in R ( Entry level R programmer and Statistics learner)

I am an entry level R programmer and trying to learn statistics. i have downloaded the daily stock Adjusted Close price of one stock from sep 2011 to till date. As per my study plan, i have plotted ...
1
vote
0answers
9 views

How can you cluster a set of functions with unknown functional forms?

Say you've $N$ functions $f_N(x)$ defined on a regular grid $x$. You don't know the form of $f(x)$, you've only got several realizations of it. The different functions are related to each other ...
0
votes
1answer
15 views

Estimating Standard Errors for Markov Transition Probability with Multiple Observations (in R)

I was trying to estimate a Markov transition table from paired transition data, which look something like this: ...
0
votes
0answers
12 views

R, TukeyHSD or HSD.test into boxplot graph [on hold]

I am trying to make boxplots of TukeyHSD data or HSD.test data Currently my code looks like this: ...
1
vote
0answers
13 views

Performing a linear regression on small dataset and trouble with modeling small predictor values

I have a dataset (posted below). y: the dependent variable (representing a ratio between the number of objects bought with the given money & the total number of objects bought) x: the independent ...
0
votes
0answers
8 views

Caret: customizing feature selection using matrix-wise operations [migrated]

Short question: is it possible to use matrix-wise operations in caretSBF$score function? Motivation: When working with big matrices in R, operations that work natively matrix-wise [e.g. rowMeans(X) ...
2
votes
1answer
50 views

chi-squared test when variables dependent

For a square matrix, is it appropriate to use a chi-squared distribution when each level of the variables are assumed to have the same overall frequency? Specifically, I'm analyzing a dataset of the ...
0
votes
0answers
8 views

Regsubsets “Linear Dependencies Found” [on hold]

I've recently been getting used to using the leaps library in R, and the regsubsets method ...
0
votes
1answer
21 views

Calculate required samples size with R with known power and ratio of n1 to n2

If I know that d=0.8, sig.level=0.95, power = 0.8, n1/n2 = 3,how can I calculate n1 and n2 with the function pwr.t2n.test(n1 = , n2= , d = , sig.level =, power = ) in R?
0
votes
0answers
10 views

Parallel multi-dimensional numerical integration in R

I am working on a problem that needs a numerical integration of a bivariate function, where each evaluation of the function takes about 1 minute. Since numerical integration on a single core would ...
2
votes
0answers
78 views

Machine Learning Algorithms, Depth of Understanding Vs Number of algorithms, [migrated]

Recently i was introduced to the field of Data Science (its been 6 months approx),and i started the journey with Machine Learning Course by Andrew Ng and post that started working on the Data Science ...
0
votes
0answers
30 views

Plotting histogram in R, error on stat=“bin”

I'm trying to plot day against number of migrations as a histogram in R, but I'm coming up with this error message: ...
1
vote
1answer
39 views

How are the p-values in the glmer (lme4) output calculated?

The output of models built using the glmer function in the package lme4 automatically includes p-values. What method does lme4 use to calculate these p-values? I can't seem to find this information ...
0
votes
0answers
27 views

data transponse in R [on hold]

sc_id sc_name testId Class_id subject marks SC_1 NET tst_1 cls_1 Mathematics 3 SC_1 NET tst_1 cls_1 Zoology 4 SC_1 NET tst_1 cls_1 ...
1
vote
1answer
57 views

Logistic Regression Odds Interpret

I was analyzing the different treatments applied to products. It started out with a a plethora of variables but I came to the conclusion that I can essentially only control the treatment applied so I ...
2
votes
1answer
22 views

When to use zero-inflated poisson regression and negative binomial distribution

I have a fairly simple dataset looking at the relationship between the first nesting date of a bird in a given year (Date) and the birds overall fledgling production from that year (Fledge; count data ...
2
votes
1answer
15 views

Overfitting with low test error

I have an ensemble of models that yields overfitting by some models by looking at the differentce between training and test error and also overfits in the combined ensemble of models providing a very ...
2
votes
3answers
201 views

Normal approximation for large data set?

I have a dataset that is highly skewed. See image below: When I transform the data I get the following histogram that makes it look normal: This data however is not normal. I get a p-value of ...
2
votes
1answer
33 views

Interpreting intercept for the log model in linear regression in R for small predictor

I have a dataset. Assume that y is the dependent variable and x is the independent variable. My goals for this analysis is mainly on the following hypothesis: Expecting x=0 to imply y=0 Expecting ...
1
vote
2answers
20 views

Mann-Whitney/Wilcoxon rank sum test in R with a table of tallies

I have a 10 treatments, 5 samples per treatment, and the result of each treatment is ranked on a ordinal scale: Poor, Fair, Moderate, Good, Excellent. I have the data tallied up so I have the total ...
0
votes
0answers
5 views

Efficient programming to overcome memory problem in R [migrated]

I have a function that calculates an index in R for a matrix of binary data. The function is: ...
1
vote
0answers
7 views

Plotting fraction of NAs of a data frame [migrated]

Does anyone know how to plot the graphs of figure 23.1 of the example chapter of Steyerberg's book? The R-function is called "na.plot2" and Displays for example the fraction of missing values in data ...
0
votes
1answer
27 views

Interaction terms and effect sizes in multiple regression

I know there are similar questions on here, but I can't quite find an answer that covers all of what I need. I am running multiple regression in r with two predictor variables and sometimes an ...
0
votes
0answers
11 views

TBATS missing value error

I used tbats to find the best fit model to a 3 years of daily data. It couldnt find a model and showed the following error: " Missing values encountered. Using longest contiguous portion of time ...
1
vote
0answers
35 views

chisq.test with R

I want to do a Goodness-of-Fit test of my data and the Weibull-distribution. I have estimated the Weibull distribution using the survreg-function in R. Now I want ...
0
votes
0answers
11 views

How do I add spaces in between the labels on the y axis as well as move the y axis label to the far left so it wont clash with the text [on hold]

How do I add spaces between the labels on the y axis as well as move the y axis label to the far left to avoid clashing as can be seen in the image below. The programme I am using is R. Please help! ...
1
vote
1answer
21 views

Mixed ANOVA post hoc analysis (and multiple comparisons)

I have a set of 12 subjects: 6 administred with drug A and 6 with drug B. For each subject two time-points have been collected (before and after drug treatment) for each analyte (over 6000). I had a ...
0
votes
0answers
5 views

model average predictions in MuMIn [on hold]

This code is taken from the MuMIn package: ...
0
votes
0answers
20 views

Non-Parametric Density estimation with a positive variable [duplicate]

I’m struggling to find a way to represent a kernel density estimation with a nonnegative random variable. I have read a couple of articles tackling this issue; however I couldn’t implement it in R. I ...
0
votes
0answers
20 views

Problem in creating neighbors,area and perimeter in spatial econometrics using R [migrated]

I’m working on a spatial cross section model with R-programming-language. I’m running these codes which refers to ...
0
votes
0answers
16 views

Covariance Matrix using Delta Method

I am trying to get the variance-covariance matrix of a transformation using the Delta Method. Originally, I have coefficients (let's call them X1, X2, etc...) and their variance-covariance matrix. ...
0
votes
0answers
12 views

How to apply a set of statistical methods to each of the clusters obtained using a specific clustering method

Suppose I have generated 2 to 10 clustering solutions and found that 4 is the optimum number of clustering solution for hierarchical clustering. Now I wanted to apply a variable selection method ...
0
votes
0answers
11 views

Storing a kd-tree

I am trying to create a kd-tree using FNN package in R. get.knnx() usually computes kd_tree whenever a new search point is encountered. My problem statement is to store the kd tree for a set of ...
0
votes
0answers
12 views

About Hypothesis Test In Spatial Regression

I'm doing estimation of spatial lag/error model using R package "spreg"/"spdep". But I can't find any method to do hypothesis test after regression. For example, I want to test whether two ...
0
votes
0answers
33 views

R: Prediction using glm() [migrated]

I am using glm() function in R with link= log to fit my model. I read on various websites that fitted() returns the value which we can compare with the original data as compared to the predict(). I ...
0
votes
1answer
32 views

backward selection multivariate analysis usind R

I want to perform an exploratory Cox regression analysis of medical data using R. I am practicing using the pbc data from the survival function. How would you recommand performing a backward ...
1
vote
2answers
36 views

HR of a continuous variable and manipulation of its interval

I am a medical intern trying to understand Cox regression modelling using R. I am using the pbc data of the survival package with the following code: ...
0
votes
1answer
47 views

Post-hoc tests for 2x2 ANOVAs (Type II & III) with interactions in R

I am trying to analyze data from an experiment using R and ran across a problem regarding the use of post-hoc tests with Type II & III ANOVAs. I only know of R functions that perform post-hoc ...
0
votes
1answer
49 views

Machine learning - curve categorisation

I have curves of the following structure (it is the blue one I am interested in) These curves reflect the volume of blood (actually gamma ray counts) in the left ventricle as a function of time ...
0
votes
0answers
20 views

Plot 2D view of 3D joint ecdf with isolines

I have this matrix, histDict, which is a dictionary of data of variable X for each value of variable ...
0
votes
0answers
35 views

R- Improving linear regression fit

I am trying to construct a predictive model in R. I am using the glm() in R to fit the model. I am getting a very high residual error after fitting the model. My target values are in the range of ...
2
votes
2answers
46 views

Confidence interval for $\eta^{2}$ for MANOVA in R

I have to report the Confidence Intervals for the $\eta^{2}$ obtained in a MANOVA in R. I use the function etasq of the package heplots to obtain the $\eta^{2}$. ...
1
vote
1answer
23 views

How to compute RMSE for TBATS

Some forecasting models in R give error terms as their output. But for TBATS, I couldnt find out that how I can see what the RMSE for my data set is. Is there any specific command that I have to use ...
0
votes
2answers
30 views

ROC (Epi library) how to calculate TP, FN,TN, FP

I'm trying to find how to compute the true negative (TN), false negative (FN), true positive (TP), and false positive (FP) if I have a cutpoint like in the following picture: ...
0
votes
1answer
21 views

Difference in rules via apriori() with target “frequent itemsets” and ruleInduction() and via apriori() with target “rules”

Regarding R package arules: To my understanding the Apriori algorithm works by first finding all frequent itemsets that meet the support threshold and then generate strong association rules from the ...
0
votes
0answers
14 views

Selecting variables in an SPSS-file (*.sav) using R [on hold]

I'd like to use a SPSS file (European Values Survey, to be more precise) in R. Specifically, I want to select certain variables (a country, a certain question [trust in armed forces] and the ...
0
votes
3answers
37 views

Simulate data for 2 x 2 ANOVA with interaction

What is the best way to simulate ANOVA data for a 2 x 2 design with interaction using a regression approach? I want to generate the data so that I know the true regression coefficients of the model ...
1
vote
1answer
19 views

Correct specification of HLM in lmer

I originally learned about random effects models when taking a course on Hierarchical Linear Models, which was taught using Raudenbush and Bryk's HLM book and software, and it sort of indoctrinated me ...