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 random vector generator

Create an R function generating ordered pairs x,y sampled from the two dimensional distribution whose pdf is of the form $f(x,y)=cxy$ $0<x,y<1$, where c is a constant to be determined. I have ...
0
votes
0answers
10 views

Monte Carlo integration, estimator

Implement an estimator using monte carlo integration $$\theta=\int_0^1e^{-x^2}(1-x)dx$$ Estimate $\theta$ with variance lower than $0.0001$ and write the variance of estimator depending on sample ...
0
votes
0answers
40 views

Learning R language [on hold]

Good evening, I'm interested in learning R, I have some books available, but sometimes it is simply not enough to learn the language in a satisfactory manner, then I would know the most experienced ...
-1
votes
0answers
27 views

Linear Model vs Multiple Linear Regression Model

I've been set these questions and as I'm new to regression, I'm having a little trouble understanding how to do this question. Hope someone here will be able to help me out, I'd really appreciate a ...
0
votes
1answer
7 views

Chi-Square transformation on a partially unknown matrix

This question is a follow up to Hellinger transformation with relative data. I want to chi-square-transform my species abundance table, which represents only a fraction of the total species table. I ...
0
votes
0answers
4 views

Network size limitations of `netlm` and `netlogit` from R's SNA package

I am trying to run netlogit on a network of about 60,000 nodes, and I would like to know if the SNA package's functions are designed to support such large ...
0
votes
0answers
10 views

Binary search tree - Finding path in weighted tree in R [on hold]

0 down vote favorite I am new in R and got tough project regarding building tree and finding shortest and longest path. Each node in the data is defined by id, id.parent and value. ...
0
votes
0answers
11 views

Variable as a column name in data frame [migrated]

Is there any way to use string stored in variable as a column name in a new data frame? The expected result should be: ...
0
votes
0answers
6 views

Error message with boot.ci: "estimated adjustment 'w' is infinite” [on hold]

I am attempting to estimate confidence intervals for effects sizes (partial eta-squared) for independent variables in a MANOVA model. Let start with the data (a minimum reproducible subset): ...
0
votes
0answers
12 views

glmer warning message in r

I'm running a glmer with the lme4 package in R. When I only include main effects in the model, it works just fine, but as soon ...
0
votes
0answers
8 views

how to do this in r laguage using normalize? [on hold]

grade each student from A to F based on their relative standing for each student(top 20 percent, next 20 percent, etc) and sort students by grade and last name. note: Math, Science and English tests ...
0
votes
0answers
27 views

Heatmap small p-values

I'm experiencing some difficulties trying to manage too small p-values derived from a Fisher test. In particular I have p-values like: 2.220000e-121, 1.260000e-26, 1.260000e-334, and so on. The ...
0
votes
0answers
20 views

95% confidence interval for p in R

I have to construct a 95% confidence interval using R, but I'm completely lost :( This is the assignment: In a random sample of 200 claims filed against and insurance company writing collision ...
-1
votes
0answers
7 views

How to code Fp tree in R programming [on hold]

i am working on coding parallel fp growth algorithm in R programming. Im finding difficulty in creating FP Tree. Kindly help me. Thanks in advance. Jeev
0
votes
0answers
6 views

Cox-Ingersoll-Ross model

I have the following r-kode for the Vasicek model model parameters r0 <- 0.02 thetaQ <- 0.05 kappa <- 0.1 sigma <- 0.015 T0 <- 1 simulation ...
1
vote
1answer
42 views

What distribution is this? (and how to simulate a sample from it in R)

This is the information given: 10% of the population is colour blind. Let $X$ be the number of colour-blind people in a sample of 20. The distribution is $X \sim Poisson(20, 2)$ - is this correct? ...
0
votes
0answers
11 views

Recoding variables with a pattern in R [migrated]

I am a stata user learning R. I want to translate the following stata function to R. Basically what it does is to recode several variable with names with a pattern with a loop function. i have ...
-1
votes
0answers
6 views

how to find critical values of Wilcoxon signed rank test in R [migrated]

I just can't find it anywhere. I know there's a qwilcox() function, but for some reason it only shows critical values of Mann-Whitney for me. Here's the table of ...
3
votes
1answer
31 views

Repeated measures ANOVA in retail sales programs?

I am studying the effects of a sales program on the weekly unit sales at ~1,000 retail locations. I am having trouble figuring out which statistical test is appropriate to run for this scenario. Here ...
0
votes
0answers
10 views

Rename a data frame using the value of a string? [migrated]

Is there a way to rename a data frame using the value of a string? I'm trying to write a function in [R] that takes a vector of values, operates over them, and (among other things) returns a data ...
0
votes
1answer
11 views

Comparabilty of BIC, AIC and ICL from Mclust. HDclassif and fem objects

I have a question regarding the way BIC, AIC and ICL are computed in the packages mclust, HDclassif and fisherEM. Both of these packages use the negation of AIC, BIC, ICL (bigger is better). This is ...
2
votes
0answers
33 views

What conclusions can I draw from an empirical probability distribution?

I have 240 samples and their relative frequencies (calculated from empirical observations), hence I have the probability distribution. It looks like this (hypothetical values): ...
0
votes
1answer
51 views

Box-Cox transformation of dependent variable only

The function powerTranform from the "car" package in R mentions the following code for Box-Cox transformation for multiple regression: ...
0
votes
1answer
7 views

R: plot(tree) how to interpret the height?

Is there any signification in the height of the split in a tree when it's plotted with R ? Example: library(rpart) plot(tree) How can we interpret the fact than ...
0
votes
0answers
9 views

How to find the sample size for non inferiority in a clinical trial using the gsdesign package in R?

I have been using the apparently very thorough gsDesign package to work out sample sizes to prove non inferiority in a clinical trial, but have been getting very different answers from what has been ...
0
votes
0answers
16 views

Model selection in R package FisherEM with function sfem()

I have a fairly simple question (I think) for users of FisherEM. I have some high dimensional data which I clustered using sparseFEM function sfem(). Several different models (with their respective ...
1
vote
1answer
26 views

Is it necessary to lexicalize the text corpus before applying lda?

While going through a sample lda example code in R R code for topic modelling, the ...
0
votes
0answers
20 views

What is the cophenetic correlation coefficient?

I want to calculate the cophenetic correlation coefficient. reading previous posts Comparison of cophenetic correlation coefficients on different data sets On cophenetic correlation for dendrogram ...
0
votes
0answers
16 views

Data normalization of different data ranges in R with reduced data loss

I have a data.frame with columns that contains data in different ranges. For example, below is the max and min values for these columns: ...
0
votes
0answers
30 views

Missing value imputation of time series in R? [on hold]

I am building time series models in R. In SAS I used proc expand to impute missing values in the time series while accounting for the trend & seasonality etc. Code used in SAS for missing value ...
0
votes
1answer
25 views

Code for detrended cross-correlation in R

I want to code for Detrended Cross Correlation in R for time-series data but I'm still stuck. I don't know why the coefficient is not in range -1 : 1. I try to write following these equation below ...
2
votes
2answers
45 views

How to reduce error rate of Random Forest in R?

I want to build a prediction model on a dataset with ~1.6M rows and with the following structure: And here is my code to make a random forest out of it: ...
0
votes
0answers
17 views

Is Multivariate Kernel Density Estimation sensitive to column order?

I'm using the Hpi and Kde functions from the R ks package. Hpi with pilot="samse" and pre="sphere". I noticed that the ...
0
votes
0answers
11 views

Calculating correlation between two different gene set of different size using R

From my previous post, I got the idea of generating correlation matrix and subsequent filtering the values for an input matrix. A problem arise is :I have a list of 8000 genes and would like to ...
1
vote
2answers
60 views

Normalizing matrix values python/R

I am trying to fill missing values in 1000 x 1000 matrices. Dataset1 contains such 1000 x 1000 matrice with value ranging 1-100. ...
1
vote
1answer
15 views

Create simulated path model dataset and save to CSV [on hold]

I am teaching a multivariate stats class and wanted to give people some simulated datasets with mediation, path modeling, and other features. I know it's possible to run monte carlo studies in MPlus, ...
0
votes
1answer
55 views

What type of test should i perform for my data?

I have a data frame with two columns. One for height and one for genotype. Genotype is a categorical variable consisting of 4 levels (B3, ein9, ein194, ein9xein194) and height is a numerical ...
0
votes
0answers
11 views

SPSS - R integration with different data models [on hold]

When using the R custom builder in SPSS Modeler 16, the R syntax uses the object modelerData to "read" the data from the stream into the functions and perform calculations or score a model. However, ...
0
votes
0answers
23 views

Outliers in Boxplots when calculating means

I have a dataset for which I am making boxplots. I do not want to include the outliers in the box plot so I give an argument outline=FALSE in the command. In the next step I want to put the mean ...
0
votes
0answers
18 views

Glmer random effects model vs. dummy-coded fixed effects

I'm trying to analyze the data from an experiment I conducted, and could use some guidance in relation to fixed vs. random effects. The experiment was related to risk-seeking behavior in the context ...
0
votes
1answer
24 views

Subsetting a set of data [on hold]

I am trying to subset a set of multivariate data using the code below but I kept getting error. I need someone to help me out. the code is as thus: ...
0
votes
0answers
21 views

Maximum likelihood estimation beta-binomial distribution with R

I have seen that there is a possibility to estimate the parameters of a beta binomial distribution with the ML method by the use of the function mle2 . But I'm having some problems maybe because of ...
0
votes
1answer
30 views

Which (dis)similarity index to choose for cluster analysis?

I have data that refer to the number of occurrences of specific variable in samples: ...
0
votes
0answers
50 views

Machine Learning: curve completion using sets of completed curves

I am very new to the world of machine learning and i am wondering if a) machine learning is able to solve the problem b) whats the best way to do it (pref with example) I have a set of curves for a ...
0
votes
1answer
18 views

Analysing data from summary table on R (interactions)

If I want to test whether data[,1]:setB is equal to 0 or not, do I just use the given t value and p value or do I need to add it with the data[,1] values? looking at the p value of data[,1]:setB, I ...
0
votes
0answers
12 views

Using R Parallel with other R packages [on hold]

I am a novice R user, and absolute novice at parallel computing. However I am working on a very time intensive analysis using the LQMM package in R. I set the model to start running on Thursday, it ...
0
votes
1answer
43 views

Why normal r.squared and fitted values are not the same when computed manually?

I am wondering if the computed R-squared from lm would be the same if you compute the predictions and then calculate ...
0
votes
0answers
4 views

How to Use fitdist to Fit Johnson Familiy of Distributions in R? [migrated]

I would like to fit a a Johnson distribution to some data using the fitdistrplus R package, in order to compare with other distribution fits. The approach I have taken is to use the SuppDists package ...
0
votes
1answer
20 views

Piecewise regression with constraints

I want to make a piecewise linear regression in R. I have a large dataset with 3 segments where I want the first and third segment to be without slope, i.e. parallel to x-axis and I also want the ...
0
votes
1answer
19 views

How could i use r to add data to a table? [on hold]

I am looking for an approach. We have a historical table with the consumption per week of a list of items (19.000 item). We want to predict the consumption for the next n weeks. We are thinking on ...