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

2
votes
1answer
10 views

Exact central confidence interval for a correlation

I am working my way through (T.J. Diccio & B. Efron, "Bootstrap Confidence Intervals", Statistical Science, 1996, 11(3), 189–228), and I'm stuck even before I get to the good stuff. In the ...
0
votes
0answers
26 views

Time varying coefficient time series [on hold]

I have a data set which is the exchange rate of USD and GBP from 2007-01-07 to 2014-06-06. I used the derivatives of a probability density to estimated the optimal bandwidth h = 0.04071872. I want to ...
2
votes
0answers
12 views

Using proper scoring rule to determine class membership from logistic regression

I am using logistic regression to predict likelihood of an event occurring. Ultimately, these probabilities are put into a production environment, where we focus as much as possible on hitting our ...
0
votes
0answers
4 views

nonlinearTest() in S-plus vs R

Is there any similar function in R does the same thing as nonlinearTest() in S-plus? I am currently working on determine the number of regimes,delayed parameter d and threshold values for the ...
0
votes
0answers
7 views

Variance of $\bar x$, simulation with non-iid observations

So I know that the variance of $\bar x$ is usually computed as $\frac{\sigma_x}{n}$, and that this assumes the observations are independent. If instead, the observations have some positive serial ...
0
votes
0answers
4 views

VARMAX model in R

Is there a function in R that estimates the VARMAX model? There is one for a VARX (MTS package), but I didn't find one that works with the MA part also...
0
votes
0answers
4 views

Time in years(x axis) shows years in .5 interval - Time Series using R [migrated]

dsales1156ts<-ts(dsales1156,frequency=365,start=c(2011,6)) # This is my time series created with daily sales data when the first sale day is 6th January 2011. plot(dsales1156ts) The ...
0
votes
0answers
9 views

Controlling overfitting with random forests for very high dimensional data

I'm using the randomForest package in R to analyse a genetic dataset of ca 100 samples with 10.000 genes. The samples are grouped into 5 classes, the smallest being only of 5 samples. I'm ultimately ...
5
votes
4answers
2k 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: ...
1
vote
0answers
3 views

Presenting results of a meta-analysis with multiple moderators?

I wish to present the results of my meta-analysis using the best practices possible. I do not find, however, examples in articles similar to what my output is. Here's a simplification of my model and ...
0
votes
0answers
10 views

R geom_smooth: what to write as aes [on hold]

I work with R and ggplot but I'm very new with it. I have already drawn point for 4 different data frames. And now I want to draw 4 regression lines for this points sets. Data frames are packed in ...
1
vote
0answers
8 views

Multiple and long seasonality for a SARIMA model in R

While working on a big data set made of 10-minutes-points of information - i.e. 144 points per day, 1008 per week and ...
0
votes
0answers
8 views

Obtaining the Psi Weights of a seasonal ARIMA in R

I am trying to quantify the effect of a future random shocks on my seasonal ARIMA model. If I have understood the theory correctly, the easiest way is to express my seasonal ARIMA model in its "random ...
0
votes
0answers
4 views

Fit GAMs with minimum constraints

I have a two-dimensional predictor plane, 0-1-Observations and a priori knowledge of minimal probabilities per combination of the predictors. I would like to fit a model (e.g. GAM from the mgcv ...
1
vote
1answer
23 views

detect line in scatter

I have repeated samples from the following process: Most samples will only contain points that are randomly distributed on a 2-dimensional plane. Sometimes, however, the sample will contain not only ...
3
votes
1answer
30 views

How to generate survival data with time dependent covariates using R

I want to generate survival time from a Cox proportional hazards model that contains time dependent covariate. The model is $h(t|X_i) =h_0(t) \exp(\gamma X_i + \alpha m_{i}(t))$ where $X_i$ is ...
0
votes
0answers
6 views

What is the best test to estimate the correlation between binomial/categorical dataset?

I'm trying to analyze if there are correlations between binomial dataset. I have binomial data (presence/absence) of two variable in different periods and I need to know what is the best way to find ...
0
votes
0answers
7 views

IT-AIC approach for mixed effects model

I was reading around the Information Theoretic-AIC approach of model selection where AIC values are used to select the candidate set of models. I am quite clear on this. My question is this: for ...
0
votes
0answers
21 views

Correlation coefficient for data table

I would like to display correlation coefficients in a table (ideally - with p-value). However, my code produces exactly the same values for each period (so something is obviously wrong). Could you ...
2
votes
1answer
63 views

Generating Random Variables with given correlations between pairs of them:

I want to generate 2 continuous random variables Q1, Q2 (quantitative traits) and 2 binary random variables Z1, Z2 (binary traits) with given pairwise correlations between all possible pairs of them. ...
0
votes
1answer
12 views

Model Formula with deflator

I'm having difficulties to find the right model formula for my model: $Y_i=a+bX_i$ where Y and X are both deflated by another variable y1/def ~ x1/def +x2/def ...
0
votes
1answer
29 views

Non-significant factors after stepwise regression [duplicate]

I have run a stepwise regression on R. However, the summary of the final model includes some factors that are not significant. Why have these factors not been removed? Should I remove these from my ...
0
votes
0answers
9 views

Predicting whether a potential sale will be won or lost

I am currently working on a project using a sales system and trying to come up with a way to use the current pipeline of potential sales to predict the amount of product that will be sold in the ...
1
vote
1answer
41 views

K means clustering inadequate in determining extreme regions in R

I want to identify the regions that are considerably higher than the highest cluster. (The obvious regions which should be identified as their own clusters, notably at the x coordinate ~10 e+07. How ...
0
votes
0answers
21 views

including interactions in a mixed linear model in R (lme)

I'm trying to test for the effect of soil moisture on transpiration rates. I have plot-level data for 18 plots in 6 different stands of trees (3 plots x 6 stands). I want to treat "stand" as a random ...
3
votes
2answers
88 views
+50

How can I include random effects into a randomForest

I'm not even sure that the question makes much sense, but I think I saw a couple of titles of papers where they proposed random forest with random effects. Is this possible in R?
4
votes
1answer
77 views

Model with non-linear transformation

I don't understand this concept well and need help. I was choosing whether to use a linear model or apply a non-linear transformation in my model formula. To do a diagnostic, I quickly plotted my ...
1
vote
1answer
22 views

How are error terms calculated for moving average model in R [duplicate]

For an ARIMA (0,0,1) model, I understand that R follows the equation: xt = mu + e(t) + theta*e(t-1) (Please correct me if I am wrong) I assume e(t-1) is same as the residual of the last observation. ...
0
votes
1answer
41 views

identify different points [on hold]

I have a large scatterplot, with about 100,000 (x,y) points. The x coordinate is the set of numbers from (1 to ~100,000) - in other words, no 2 points have the same x-coordinate. The y is mostly ...
0
votes
0answers
13 views

Simulation of a nested demand structure, depending upon price and time, following a poisson process

Suppose I sell a product to prices $p\in \{50,100,200\}$ to different points in time $t\in \{1,2,3\}$. Thus a poisson distributed random variable $Y_{t,i} \sim \text{Poi}\left(\lambda\left( ...
0
votes
0answers
14 views

How to make IPF code faster and more concise in R

Iterative proportional fitting is a way of adjusting 'internal cells' in a multidimensional matrix to optimise fit. It is also known as 'raking' and can be seen as a subset of 'entropy maximisation'. ...
21
votes
4answers
7k views

R libraries for deep learning

I was wondering if there's any good R libraries out there for deep learning neural networks? I know there's the nnet, ...
0
votes
0answers
15 views

Create correlation map [on hold]

I'm aware that you have a post on almost exactly the same topic, but after many trials I failed to run (or plot?) it successfully. When running ...
0
votes
0answers
14 views

Missing Value in Commodities Prices

I am trying to model the prices of four energetic commodities with ARIMA models in R. Unfortunately the price series is not regular, as for some days, like Christmas, no price is given. My series is ...
2
votes
1answer
39 views

How can I estimate model predicted means (a.k.a. marginal means, lsmeans, or EM means) from a GEE model fitted in R?

I am trying to obtain model-predicted means and CI's for a categorical predictor in a GEE model fitted with the geeglm function (geepack package). The model is fitted with no problem, but where I am ...
1
vote
0answers
50 views

consequences of lagged dependent variables in panel data and how to deal with it?

I have some elementary problems understanding the consequences of using/adding a lagged dependent variable in my predictive model. I’m trying to predict values $Y_{i,t+\tau}$ for $\tau=1-3$ with: ...
4
votes
3answers
564 views

How do you report percentage accuracy for glmnet logistic regression?

I am using glmnet where my dependent variable is binary (class 0, class 1). I want to report percentage accuracy of the model. So I use the ...
0
votes
0answers
25 views

Errors when fitting a SARIMAX model in R

Currently working on big data sets, I would like to fit a SARIMAX model to it in order to forecast future values. Here are my questions : Q1. As a matter of information, does anybody know how does R ...
0
votes
0answers
37 views

VIF in GLM model in R

Before running or building a model, ho can we check on the multicollinearity between different covariates in GLM model in R? I know that SAS Proc MIXED procedure gives a column for VIF which is very ...
0
votes
0answers
32 views

Problem when doing pre-whitening before ccf analysis [migrated]

I have following R code which does not work when trying to pre-whiten other series by the model generated for the other series. ...
0
votes
1answer
42 views

How to translate R to SQL for a Cox Proportional Hazards model?

I have built a cox model in R using the coxph function in the survival package, and now I need to replicate the model in SQL for scoring. From my understanding, the model has the form described on ...
1
vote
1answer
26 views

How to choose the right distance matrix for clustering?

I am attempting simple Ward type clustering. However, the R package is proving several choices to use for the distance matrix. I am wondering how I am supposed to determine the right distance matrix ...
0
votes
0answers
27 views

R function which uses innovations algorithm?

I can't seem to find much info on the following: I have a dataset D at time t which I use to fit an ARIMA model. I forecast the value of the time series at time t + 1. Now, when I'm in t + 1, I would ...
0
votes
1answer
56 views

Visualize process data

I have a dataset of order processing with 8 million rows with following columns: HistoryId - Identity column of the records ...
0
votes
0answers
14 views

Label positioning issues using R's base plotting system [on hold]

I would like to resolve label positioning issues in the plot shown below by using R's base plotting system. I realise that this question is in/directly related to a question asked at ...
1
vote
1answer
44 views

Multivariate model in lme() with independent random effect, similar to MCMCglmm

I would like to specify a multivariate model with lme with a random effect for group which is independent across variables. I found this post, which explains that ...
0
votes
0answers
8 views

Estimating Pearson III density using R's lmomco package

I am trying to estimate parameters for a Pearson III distribution using package "lmomco" (session information given at the end). I have 40 precipitation values in vector "val.x". I estimate P3 ...
0
votes
0answers
15 views

Conditional Inference Trees in R

Consider the following data set test with binary outcome variable z and predictor variables a,b,c. ...
2
votes
1answer
415 views

How to validate and compare models predicting a binary variable?

I have a question about determining which models are "better" and how to assess that info. Let's say I have three models, each which predicts our bid on won ping. Our bid is a continuous variable and ...
0
votes
0answers
17 views

Assessing the effect of related variables using lmer in R

I am trying to run a model to describe the rate of water table drawdown in the soil. The predicted variable is rate, and I am interested in the effect of two categorical variables: (1) if the water ...