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

-1
votes
0answers
5 views

R: creating a new column in Quandl data

Beginner R user here. I am trying to recreate this! Quandl for R tutorial. Here is the code in GitHub. When I run lines 81 and 82 I get an error message stating "Error in ...
1
vote
1answer
9 views

Varying Non-Linear Parameters Based on Groups in R

I'm trying to develop a non-linear model, but I'd like to have the values for the parameters vary by group. To give you an example, a section of my data (just random numbers here) looks like: ...
1
vote
0answers
6 views

Labels missing in R likert plot [migrated]

I am trying to plot a simple likert graph. Somehow I am not able to set the value of legends. Can anyone please tell me how can I do that? The following is the ...
0
votes
0answers
3 views

R - Robust Ancova: Documentation/Examples for the ancmg function in the WRS package

Could anyone point me to a documentation or even better an example for the ancmg1 or ancmg functions of the WRS-package. There is a very short paragraph in the Wilcox' book about Robust Estimation, ...
1
vote
1answer
20 views

Model specification with Deflators: methodological question on forecast model

I am trying to build a model to predict one year ahead Earnings per share $(t+1)$ based on variables in year $t$. I’ve seen a lot of models in practice that use the following methodology: ...
2
votes
1answer
28 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
6 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
6 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
1answer
40 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^2}{n}$, and that this assumes the observations are independent. If instead, the observations have some positive serial ...
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
12 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 ...
2
votes
1answer
23 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 ...
1
vote
0answers
6 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 ...
1
vote
0answers
9 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
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 ...
0
votes
0answers
9 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
32 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 ...
0
votes
0answers
9 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 ...
1
vote
1answer
20 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
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
0answers
29 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 ...
0
votes
1answer
35 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
27 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 ...
4
votes
1answer
82 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
2answers
49 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
14 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
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 ...
0
votes
1answer
43 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 ...
1
vote
1answer
23 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
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'. ...
0
votes
1answer
47 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 ...
0
votes
0answers
26 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
15 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 ...
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. ...
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 ...
1
vote
1answer
23 views

What does y argument do in chisq.test in R?

The chisq.test function in R includes a y = argument, which is to NULL by default. The help ...
1
vote
1answer
28 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
0answers
21 views

Extracting/Exporting the Data of the Empirical Cumulative Distribution Function in R (ecdf) [migrated]

I use R to calculate the ecdf of some data. I want to use the results in another software. I use R just to do the 'work' but not to produce the final diagram for my thesis. Example Code ...
0
votes
0answers
15 views

Selecting from a bigger control group for 1:1 ratio

What I have is a treatment group consisting of 90 individuals. I have a pool of individuals eligible for my control group, which I want to be matched by age and gender in a 1:1 ratio. Is there any ...
1
vote
0answers
5 views

How to calculate model residuals from MCMCregress [migrated]

I'm doing classwork using Bayesian inference. For this, I'm using the MCMCregress function, from MCMCpack. The problem comes ...
0
votes
0answers
15 views

Determine the threshold value and number of regimes with delayed variable

I am currently working on a threshold model for the exchange rate between UK and US. I have not got background knowledge on this model so I am really stuck on how to determine the Threshold value, ...
0
votes
0answers
13 views

Threshold Models

Im trying to estimate a momentum threshold model for relationship between main stock index, political-risk and economic-risk. The equation I want to evaluate is ...
0
votes
0answers
24 views

List of All Possible Orderings of a Sequence Using R [on hold]

If I have a sequence consisting of three successes and seven failures SSSFFFFFFF, the number of unique orderings of the sequence is choose(10,3) = 120 using R. Is there a function in R that will list ...
0
votes
0answers
22 views

Log-likelihood (and AIC) of robust nlrob model differs from standard nls model

Comparing models generated by nlrob to ones generated by nls, I've noticed that even though the models might be nearly identical, the log-likelihood of the models is sometimes significantly different, ...
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 ...
0
votes
0answers
24 views

Understanding ANOVA formula in R and choosing the most appropriate model

I am new to R (and by extension statistics), and am having a tough time in making sense of this repeated measures ANOVA formula, please bear with me. I think I understand what the formula implies, but ...