Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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

5
votes
1answer
2k views

Tangency portfolio in R

I am trying to solve for an efficient portfolio in R. How do I translate my constraints for a tangency point for 2 risky asset portfolio, and a given risk free rate to R solve.QP function? So ...
7
votes
10answers
2k views

I just installed the latest version of R. What packages should I obtain?

Duplicate thread: What R packages do you find most useful in your daily work? Are there any R packages that are just plain good to have, regardless of the type of work you are doing? If so, what are ...
6
votes
2answers
1k views

How to fit a negative binomial distribution in R while incorporating censoring

I need to fit $Y_{ij} \sim NegBin(m_{ij},k)$, i.e. a negative binomial distribution to count data. However, the data I have observed are censored - I know the value of $y_{ij}$, but it could be more ...
353
votes
25answers
128k views

Python as a statistics workbench

Lots of people use a main tool like Excel or another spreadsheet, SPSS, Stata, or R for their statistics needs. They might turn to some specific package for very special needs, but a lot of things can ...
4
votes
3answers
1k views

Recreating traditional null hypothesis testing with Bayesian methods

I am trying to recreate (in R) a frequentist hypothesis testing in Bayesian from, by calculating Bayes factors of the null (H0) and alternative (H1) models. The model is simply a simple linear ...
9
votes
2answers
22k views

Is it possible to directly read CSV columns as categorical data?

I need to analyze with R the data from a medical survey (with 100+ coded columns) that comes in a CSV. I will use rattle for some initial analysis but behind the scenes it's still R. If I read.csv() ...
60
votes
5answers
54k views

What do the residuals in a logistic regression mean?

In answering this question John Christie suggested that the fit of logistic regression models should be assessed by evaluating the residuals. I'm familiar with how to interpret residuals in OLS, they ...
6
votes
3answers
1k views

Mixed regression models and custom link functions in R?

It seems like the current revision of lmer does not allow for custom link functions. If one needs to fit a logistic linear mixed effect model with a custom link function what options are available ...
6
votes
1answer
2k views

How could I predict the results of a simple card game?

I want to predict the results of a simple card game, to judge on average, how long a game will last. My 'simple' game is; Cards are dealt from a randomised deck to n players (typically 2-4) Each ...
6
votes
3answers
957 views

Visualizing two scalar variables over time

What would be the best way to display changes in two scalar variables (x,y) over time (z), in one visualization? One idea that I had was to plot x and y both on the vertical axis, with z as the ...
8
votes
2answers
8k views

How can I obtain some of all possible combinations in R?

Sometimes I want to do an exact test by examining all possible combinations of the data to build an empirical distribution against which I can test my observed differences between means. To find the ...
16
votes
3answers
14k views

A non-parametric repeated-measures multi-way Anova in R?

The following question is one of those holy grails for me for some time now, I hope someone might be able to offer a good advice. I wish to perform a non-parametric repeated measures multiway anova ...
6
votes
3answers
2k views

How can one speed up this correlation calculation in R without multicore?

I have a colleague who calculates correlations in which one set of scores for a subject (e.g. 100 scores) is correlated with another set of scores for that same subject. The resulting correlation ...
2
votes
2answers
451 views

What code would you put before/after your R session? [closed]

R allows us to put code to run in the beginning/end of a session. What codes would you suggest putting there? I know of three interesting examples (although I don't have "how to do them" under my ...
7
votes
1answer
1k views

Why does AIC formula in R appear to use one extra parameter than expected?

I'll use an example so that you can reproduce the results ...
4
votes
2answers
1k views

R command for stcox in Stata

What is the equivalent command in R for the stcox command in Stata?
33
votes
14answers
7k views

References for survival analysis

I am looking for a good book/tutorial to learn about survival analysis. I am also interested in references on doing survival analysis in R.
2
votes
2answers
2k views

Column Means Significance Tests in R

New to the site. I am just getting started with R, and want to replicate a feature that is available in SPSS. Simply, I build a "Custom Table" in SPSS with a single categorical variable in the ...
1
vote
3answers
193 views

How can I get R to stop autocompleting my quotes/parens? [closed]

When I type a left paren or any quote in the R console, it automatically creates a matching one to the right of my cursor. I guess the idea is that I can just type the expression I want inside without ...
0
votes
2answers
3k views

R lrm model with no predictors

I am creating multiple logistic regression models using lrm from Harrell's Design package in R. One model I would like to make is the model with no predictors. For example, I want to predict a ...
27
votes
5answers
8k views

Any suggestions for making R code use multiple processors?

I have R-scripts for reading large amounts of csv data from different files and then perform machine learning tasks such as svm for classification. Are there any libraries for making use of multiple ...
59
votes
8answers
32k views

Is PCA followed by a rotation (such as varimax) still PCA?

I have tried to reproduce some research (using PCA) from SPSS in R. In my experience, principal() function from package psych ...
26
votes
1answer
2k views

How can one empirically demonstrate in R which cross-validation methods the AIC and BIC are equivalent to?

In a question elsewhere on this site, several answers mentioned that the AIC is equivalent to leave-one-out (LOO) cross-validation and that the BIC is equivalent to K-fold cross validation. Is there ...
20
votes
4answers
18k views

Post-hocs for within subjects tests?

What is the preferred method for for conducting post-hocs for within subjects tests? I've seen published work where Tukey's HSD is employed but a review of Keppel and Maxwell & Delaney suggests ...
20
votes
2answers
4k views

How does random forest generate the random forest

I am not an expert of random forest but I clearly understand that the key issue with random forest is the (random) tree generation. Can you explain me how the trees are generated? (i.e. What is the ...
8
votes
4answers
763 views

Why is the average of the highest value from 100 draws from a normal distribution different from the 98th percentile of the normal distribution?

Why is the average of the highest value from 100 draws from a normal distribution different from the 98% percentile of the normal distribution? It seems that by definition that they should be the ...
23
votes
9answers
7k views

Time series for count data, with counts < 20

I recently started working for a tuberculosis clinic. We meet periodically to discuss the number of TB cases we're currently treating, the number of tests administered, etc. I'd like to start ...
78
votes
21answers
39k views

Free resources for learning R

I'm interested in learning R on the cheap. What's the best free resource/book/tutorial for learning R?
39
votes
3answers
12k views

Clojure versus R: advantages and disadvantages for data analysis

I had a plan of learning R in the near future. Reading another question I found out about Clojure. Now I don't know what to do. I think a big advantage of R for me is that some people in Economics ...
5
votes
5answers
2k views

Where can I find useful R tutorials with various implementations? [duplicate]

I'm using R and the manuals on the R site are really informative. However, I'd like to see some more examples and implementations with R which can help me develop my knowledge faster. Any suggestions?
28
votes
26answers
11k views

What R packages do you find most useful in your daily work?

Duplicate thread: I just installed the latest version of R. What packages should I obtain? What are the R packages you couldn't imagine your daily work with data? Please list both general and ...
5
votes
3answers
2k views

R packages for seasonality analysis [closed]

What R packages should I install for seasonality analysis?
8
votes
6answers
3k views

Algorithms and methods for attribute/feature selection?

I have data with continuous class and I'm searching for good methods to reduce number of attributes. Now I'm using correlation based filters, random forests and Gram–Schmidt algorithm. What I want ...