Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

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

20,810 questions
Filter by
Sorted by
Tagged with
6k views

### Monte Carlo simulation for VaR estimation using R

As I am not very experienced in financial econometrics I need help in writing R code for MC simulation for VaR estimation. Namely, reading some books and reference manuals for R packages, I ended up ...
5k views

### How to get the difference of two numbers (standard deviation)?

I have many pairs like: A B 10 20 15.3 19.5 23 13 45 32 etc etc, I create those pairs calculating the standard deviation of many vectors (R vectors) and then ...
6k views

### Is there a term for min + (max - min) / 2?

I'm looking for a function to do that in R. I know how to write that function. Just don't want to reinvent something.
332 views

### Data structures and libraries for high dimensional text analysis with R

I am going to be using R for text analysis (mostly clustering, classification and some visualization) and was wondering what mechanisms R provides for handling high dimensional, sparse data sets. If I ...
1k views

### Function to convert arithmetic to log-based covariance matrix?

Is there a function in R that will take the mu and Sigma of an arithmetic-covariance matrix and return the mu and Sigma of a log-based covariance matrix? I have the code for a function implementing ...
8k views

### Using R's aov() for two-way repeated-measurement ANOVA

We analyze blood vessel samples of patients in an organ bath which gives us force values. Each subject (patient) donates two types of blood vessels (pulmonary vein and pulmonary artery). The organ ...
14k views

### Time dependent coefficients in R - how to do it?

Update: Sorry for another update but I've found some possible solutions with fractional polynomials and the competing risk-package that I need some help with. The problem I can't find an easy way to ...
438 views

### Is it possible to compare multiple proportions in subdata sets?

There is one medical data set which contains 3 treatments: A, B, and C. The response variable is Yes/No. However, due to a specific medical reason, the dataset needs to be split into several sub-...
4k views

### Estimating random effects and applying user defined correlation/covariance structure with R lme4 or nlme package

I have following type of data. I have evaluated 10 individuals each repeated 10 times. I have 10x10 relation matrix (relationship between all combination of the individuals). ...
19k views

### Fisher's exact test in R

First, I am no expert but I am analyzing some marketing data. I have information on two versions of the same site, and I have data on the number of times people filled out a form on each version of ...
4k views

### How do I parameterize a Weibull distribution in JAGS / BUGS?

Based on the answer to a previous question, For which distributions are the parameterizations in BUGS and R different? I have been transforming R parameterizations to JAGS parameterizations, but I ...
2k views

421 views

### R sparse smoothing splines

I would like to fit a model of the form weight ~ bs(height) + id, where id is a factor (so I have several observations per every id). There are perhaps 100k values ...
3k views

### Odd error with caret function rfe

library(caret) set.seed(1) x <- data.frame(runif(10),runif(10)) y <- rnorm(10) rfeModel <- rfe(x,y,rfeControl = rfeControl(functions = lmFuncs)) returns:...
224 views

### R: looking for “time” clusters in a data set [closed]

I am new to R and seeking some advice. I have a set (~20M) of data describing on which step a process did fail or succeeded: ...
1k views

### How to analyze the volatility with GARCH?

How could I use GARCH model to detect if the volatility is constant during all the series(time series)? I can't do a visual check, I need to detect if the volatility is constant using R and GARCH ...
761 views

### Displaying multiple conditional distributions using lattice

I have a data frame which contains several true/false columns, some numeric and a class (target) variable which has true/false values. Now, how can I produce with R multiple barplots for all ...
9k views

### Fitting a multivariate ARIMA model with R

I have 4 correlated time series, and I want to predict one of them, from the other 3. There is a clear seasonal effect in the 4 time series, so my first thought was to fit a multivariate ARIMA model, ...
278 views

### Controlled experiment with binary outcome variable

I have data from an experiment where students were tested on multiple words for the correct pronunciation of a specific linguistic phenomena. The experiment was done with a control and experimental ...
1k views

### Algorithms to find most frequent data

I want to find most frequent words in some cases that some words stand out. I have two data for each case, the word and the number of times it appears. I want to know which algorithms, techniques can ...
7k views

### Assessing logistic regression models

This question arises from my actual confusion about how to decide if a logistic model is good enough. I have models that use the state of pairs individual-project two years after they are formed as a ...
10k views

### Predicted by residual plot in R

I'm wondering what the difference is between: 'predicted by residual plot' where I plot the residuals of the regression with the predicted values of the regression ; the case where I plot the ...
42k views

### What are the predicted values returned by the predict() function in R when using original data as input?

After running a regression of the form reg <- lm(y ~ x1 + x2, data=example) on a dataset, I can get predicted values using ...
4k views

### Plotting regression predictors

In the case of multiple regression where I have dependent variable Y and two predictors X1 and X2 I would like to make a plot of their relationship before fitting a regression, however the plot ...
51k views

### How to interpret coefficient standard errors in linear regression?

I'm wondering how to interpret the coefficient standard errors of a regression when using the display function in R. For example in the following output: ...
1k views

### How to calculate all the combinations in R?

I have four letters: A B C D, I need to calculate all the combinations on the follow type: ...
226 views

### How to compute simulated differences of means repetitively?

I would like to run a 1000 simulations of $X-Y$ where $X$ is the average of 100 random observations with mean of 69.5 and SD 2.9 and $Y$ is the average of 100 random observations with mean of 63.9 ...
7k views

### Computing probability from the Poisson distribution

I have a question regarding the ppois function in R: ppois(x,lambda,lower.tail=TRUE) gives $P[X>x]$ ...
303 views

### Binomial regression with penalized ML

These coefficients look way too large to me, they seem to imply probabilities of around 0.5, instead of around .01, as I would expect. Here is sample code: ...
1k views

### Generating random numbers based on 'rule-of-thumb' proportions

I will try to be as clear as I possibly can: I want to populate a matrix of about 10 million rows by 43 columns as a test to an application The first task is to generate a random number around 10 ...
7k views

### Intraclass correlation (ICC) for an interaction?

Suppose I have some measurement for each subject at each site. Two variables, subject and site, are of interest in terms of computing intraclass correlation (ICC) values. Typically I would use ...
16k views

### Collinearity between categorical variables

There's a lot about collinearity with respect to continuous predictors but not so much that I can find on categorical predictors. I have data of this type illustrated below. The first factor is a ...
1k views

### Getting spline coefficients in R

I'm fitting a natural basis spline on a data set of the form: splineModel=lm(dist~bs(speed, df=3), data=cars) using bs ...
311 views

### Linear statistic for measuring association in the party R package

I had asked a general question about conditional inference trees via party a while back and gotten a great reply. I am revisiting this procedure and trying to make sense of the linear statistic that ...
3k views

### Transformation to fit gamma distribution for glm

The data simulated below has a maximum value of 4 and is interestingly skewed. The maximum of 4 is a limitation imposed by the instrument used and the data is semi-discrete, i.e., there are a ...