Questions tagged [r]

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`.

Filter by
Sorted by
Tagged with
3
votes
1answer
1k views

R package ltm: How to manipulate title on item response category characteristic curve plot

I have conducted an IRT analysis using package ltm in R 2.10. fit1 <- grm(data) When producing plots of item response characteristic curves (ICCs), ...
7
votes
1answer
6k views

Recreating R's hist function's bin counting

I have some data that I've built histograms out of in R. Now I want to play around with the data, but first I want to summarise it in the same way the histogram does. That is, I want to take my data ...
2
votes
2answers
5k views

Calculating posterior probabilities in R?

I asked a question earlier on here. Essentially, I am trying to evaluate a warning system that consists of a light bulb (of a specific color) being switched on, to indicate a predicted warning threat ...
49
votes
3answers
23k views

Is it possible to do time-series clustering based on curve shape?

I have sales data for a series of outlets, and want to categorise them based on the shape of their curves over time. The data looks roughly like this (but obviously isn't random, and has some missing ...
10
votes
4answers
1k views

Given a 10D MCMC chain, how can I determine its posterior mode(s) in R?

Question: With a 10 dimensional MCMC chain, let's say I'm prepared to hand you a matrix of the draws: 100,000 iterations (rows) by 10 parameters (columns), how best can I identify the posterior modes?...
41
votes
1answer
53k views

Rank in R - descending order [closed]

I am looking to rank data that, in some cases, the larger value has the rank of 1. I am relatively new to R, but I don't see how I can adjust this setting in the rank function. ...
5
votes
3answers
679 views

How hard is to convert a library from S-PLUS 8.0 to R? [closed]

I have a S-Plus library which I'd like to convert to R. I am a programmer, but I don't know anything about S-Plus or R. From my research it seems that they are highly compatibile. Is that true? The ...
6
votes
1answer
1k views

Interpreting 2D correspondence analysis plots (Part II)

I'd like to ensure that I understand the process correctly. This is a follow-up question to Interpreting 2D correspondence analysis plots ...
7
votes
3answers
4k views

Distance between empirically generated distributions (in R)

I'm not a statistician, but I sometimes need I play around with data. I have two data sets, lists of values in the unit interval. I've plotted them as histograms, so I have an intuitive idea of how "...
8
votes
3answers
5k views

Clustering genes in a time course experiment

I have seen a few queries on clustering in time series and specifically on clustering, but I don't think they answer my question. Background: I want to cluster genes in a time course experiment in ...
39
votes
5answers
22k views

Time series 'clustering' in R

I have a set of time series data. Each series covers the same period, although the actual dates in each time series may not all 'line up' exactly. That is to say, if the Time series were to be read ...
37
votes
5answers
19k views

Timing functions in R [closed]

I would like to measure the time that it takes to repeat the running of a function. Are replicate() and using for-loops equivalent? For example: ...
4
votes
2answers
157 views

How to create a vector with equivalent spacing between its consecutive elements in R?

I was wondering how to create a vector with equivalent spacing between its consecutive elements in R? In Matlab, I can do [start:step:end]. Also if I want to plot a function with analytical form, do ...
38
votes
3answers
45k views

Mode, Class and Type of R objects

I was wondering what are the differences between Mode, Class and Type of R objects? Type of a R object can be obtained by typeof() function, mode by mode(), and class by class(). Also any other ...
4
votes
1answer
305 views

Given sample size, group means, and misc. post-hoc range statistics, can you suggest a good way to estimate variance through simulation?

I previously asked this question about the validity of my solutions for for $SE$ given $n$, $\bar{X_i}$ and summary statistics from post-hoc multiple comparisons such as Fisher's $LSD$ and Tukey's $...
28
votes
3answers
2k views

Getting seRious about time series with R

If you think back, to when you first started with time series analysis. What tools, R packages and internet resources do you wish you had known about? What I'm trying to ask is, where should one ...
15
votes
5answers
3k views

A good way to show lots of data graphically

I'm working on a project that involves 14 variables and 345,000 observations for housing data (things like year built, square footage, price sold, county of residence, etc). I'm concerned with trying ...
3
votes
2answers
5k views

How to calculate cex.axis automatically so to fit to the maximal width possible (in R)? [closed]

Let's say we created a plot, with labels: plot(1, xlab = "text", ylab = "text times three") # text too small In this plot there is still a lot of free region to ...
8
votes
4answers
14k views

Linear model with constraints

I'm quite new to R and I have a following problem: I have a simple 2-factor linear model: ...
49
votes
6answers
221k views

How to perform a test using R to see if data follows normal distribution

I have a data set with following structure: a word | number of occurrence of a word in a document | a document id How can I perform a test for normal ...
13
votes
2answers
14k views

Cross-correlation significance in R

How do you tell if the correlations at different lags obtained from the cross-correlation (ccf function) of two time series are significant.
10
votes
4answers
3k views

How to look for valleys in a graph?

I'm examining some genomic coverage data which is basically a long list (a few million values) of integers, each saying how well (or "deep") this position in the genome is covered. I would like to ...
20
votes
7answers
47k views

Mean of a sliding window in R

I have a vector of values that I would like to report the average in windows along a smaller slide. For example, for a vector of the following values: ...
29
votes
4answers
12k views

How to do dimensionality reduction in R

I have a matrix where a(i,j) tells me how many times individual i viewed page j. There are 27K individuals and 95K pages. I would like to have a handful of "dimensions" or "aspects" in the space of ...
3
votes
4answers
2k views

How to escape symbolic value in R [closed]

I just loaded a csv file in R. When I ran the summary command for one of the columns, I got the following: ...
10
votes
5answers
9k views

Omega squared for measure of effect in R?

The statistics book I am reading recommends omega squared to measure the effects of my experiments. I have already proven using a split plot design (mix of within-subjects and between-subjects design) ...
18
votes
1answer
601 views

Have I computed these likelihood ratios correctly?

I'm the author of the ez package for R, and I'm working on an update to include automatic computation of likelihood ratios (LRs) in the output of ANOVAs. The idea is to provide a LR for each effect ...
3
votes
4answers
3k views

kNN randomization test in R?

I am trying to determine significant differences between groups of data using a k-nearest neighbor randomization test in R. This test basically looks for similarity amongst homogenous groups and ...
4
votes
1answer
1k views

Calculating probability for bivariate normal distributions based on bootstrapped regression coefficients

Dear all, I was encouraged to ask this question here as well as on stackoverflow and would be very appreciative of any answers... Due to hetereoscedasticity I'm doing bootstrapped linear regression (...
1
vote
3answers
5k views

How to analyze these data?

The biological data is listed as following: ...
13
votes
3answers
9k views

An easy explanation for the parallel coordinates plot

I have read and seen a lot of Parallel coordinates plots. Can someone answer the following set of questions: What are parallel coordinates plots (PCP) in simple words, so that a layman can understand?...
11
votes
1answer
7k views

What is the difference between summary() and loadings() for princomp() object in R?

Example code: (pc.cr <- princomp(USArrests)) summary(pc.cr) loadings(pc.cr) ## note that blank entries are small but not zero I am getting different ...
6
votes
3answers
3k views

Algorithm for choosing the number of clusters when using pam in R?

I am clustering a dataset using the pam command (from {cluster} package), and I wish to decide on the number of clusters to use. I was able to implement The_Elbow_Method in R (see wiki) for doing ...
5
votes
1answer
170 views

R plots to a connection?

Is there a way to have R plot to an in-memory object or connection, rather than a named file? I would like to have a plotting server create many graphs without ever going to a file. The Cairo ...
22
votes
4answers
27k views

How to project a new vector onto PCA space?

After performing principal component analysis (PCA), I want to project a new vector onto PCA space (i.e. find its coordinates in the PCA coordinate system). I have calculated PCA in R language using <...
10
votes
2answers
7k views

When to use (non)parametric test of homoscedasticity assumption?

If one is testing assumption of homoscedasticity, parametric (Bartlett Test of Homogeneity of Variances, bartlett.test) and non-parametric (Figner-Killeen Test of ...
7
votes
2answers
879 views

Gputools for R: how to interpret the experimental procedure?

The following paper describes an implementation of R in parallel on a graphics processing unit (GPU). Buckner et al., The gputools package enables GPU computing in R, BIOINFORMATICS, Vol. 26 no. 1 ...
13
votes
3answers
615 views

Estimate the size of a population being sampled by the number of repeat observations

Say I have a population of 50 million unique things, and I take 10 million samples (with replacement)... The first graph is I've attached shows how many times I sample the same "thing", which is ...
14
votes
1answer
16k views

How to make age pyramid like plot in R?

Age pyramid looks like this: I would like to make something similar, namely a 2 barplots (not histograms) with same categories, rotated vertically and extending to both sides as in pyramid. Is it a ...
14
votes
4answers
2k views

LOESS that allows discontinuities

Is there a modelling technique like LOESS that allows for zero, one, or more discontinuities, where the timing of the discontinuities are not known apriori? If a technique exists, is there an existing ...
6
votes
1answer
359 views

Is there a biglm equivalent for coxph?

I am trying fit a Cox Proportional Hazard model with coxph with a cmoputer of 12GB of RAM. It keeps running out of memory. Is there a biglm equivalent of coxph?
14
votes
2answers
6k views

Why does the random forest OOB estimate of error improve when the number of features selected are decreased?

I am applying a random forest algorithm as a classifier on a microarray dataset which are split into two known groups with 1000s of features. After the initial run I look at the importance of the ...
77
votes
3answers
59k views

Best way to present a random forest in a publication?

I am using the random forest algorithm as a robust classifier of two groups in a microarray study with 1000s of features. What is the best way to present the random forest so that there is enough ...
10
votes
1answer
4k views

Output of logistic model in R

I'm trying to interpret the following type of logistic model: mdl <- glm(c(suc,fail) ~ fac1 + fac2, data=df, family=binomial) Is the output of ...
2
votes
1answer
379 views

Setting up experiment for statistical analysis

I am looking at setting up an experiment concerning a hobby of mine, basically measuring a variety of parameters 'before' and 'after' and see which one, if any, gives the most reliable prediction of a ...
7
votes
1answer
6k views

Determination of effect size for a repeated measures ANOVA power analysis

This is a follow-up to the repeated measures sample size question. I am planning a repeated measures experiment. We record energy usage for 12 months, then give (a randomly assigned) half of the ...
-1
votes
1answer
184 views

Counting how many times a package has been loaded in R? [closed]

Following this question, I wish to have some way of counting how many times I am using a package in my daily work. Is there a function/package to do that? In case there isn't, how would you ...
3
votes
1answer
5k views

Adding labels to points using mds and scatter3d package with R

I have a dataset forwhich i have performed an mds and visualized the results using scatterplot3d library. However i would like to see the names of the points on the 3d plot. How do i accomplish that? ...
8
votes
4answers
2k views

Kaplan-Meier, survival analysis and plots in R

What is the best package to to do some survival analysis and plots in R? I have tried some tutorials but I couldn't find a definite answer. TIA
57
votes
6answers
18k views

Alternatives to logistic regression in R

I would like as many algorithms that perform the same task as logistic regression. That is algorithms/models that can give a prediction to a binary response (Y) with some explanatory variable (X). ...