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

learn more… | top users | synonyms

1
vote
0answers
18 views

Ideal statistical or machine learning technique to model highly cross-correlated data

I'm trying to build a model that can predict streamflow for an alpine (snowmelt-fed) watershed using snow albedo (roughly, the energy reflectance of the snow) data. Albedo controls the melt of the ...
0
votes
0answers
14 views

R: Finding relationships between 2 variables to determine any patterns in data

I am working on finding relationships/patterns between 2 variables (Type_A, Type_B). ...
0
votes
0answers
17 views

Metropolis-Hastings MCMC for Bayesian Regression in R

I am looking for a teaching example of a multivariate (not bivariate) implementation of Metropolis-Hastings for MCMC in R. I know several packages implement the algorithm more generally, but the code ...
0
votes
1answer
9 views

LOOCV $R^2$ higher than regular $R^2$ in RF

I am working with RF and the caret package, and I am having a confusion because sometimes the LOOCV $R^2$ is higher than the regular $R^2$. Is it right? How can I interpret this? Here an example ...
1
vote
0answers
8 views

Can there be a situation where one regression model gives lower RMSE than the other but also lower R-squared?

Consider the following scenario where you use the same data X (the same number of predictors p, same number of observations ...
0
votes
0answers
10 views

R packages for Durbin-Levinson algorithm and innovation algorithm for time series forecasting [migrated]

I am looking for a package in R that implements the Durbin-Levinson algorithm for time series forecasting in $AR(p)$ model and innovation algorithm for $MA(q)$ and $ARMA(p,q)$ model. I looked at ...
0
votes
1answer
42 views

Test whether two predictions are significantly different

I am currently stuck with a problem regarding predictions from linear regressions. I estimated a simple (multivariate) regression model y = b0 + b1 * x + b2 * X, where x is my variable of interest and ...
1
vote
0answers
6 views

How can I compute cross-correlation and auto-correlation in R using pooled data?

I'm trying to perform a lagged linear regression on time series data sourced from ~10,000 hospital patients, for the purpose of estimating causal relationships between administration of a drug and a ...
0
votes
1answer
20 views

What are the best R packages for a classification problem with use of Neural networks [on hold]

Surfing on the internet shows me that there are a lot of different packages and functions which can be used to train neural networks via R. packages such as 'RSNNS', 'nnet','neuralnet', etc. I'm ...
0
votes
1answer
18 views

How to check if the data is intermittent or too many zeros are due to seasonality?

I have a dataset for weekly number of calls to a call center for three years.The data is seasonal (I know this from practitioners knowledge) which means that calls normally come on summer and winter. ...
0
votes
0answers
28 views

What is the difference between Clustering and Mixture Model Fitting

I want to know what is the difference between clustering methods and mixture model fitting. When do we use one method and when the other? How can we see or test, which method we should/can apply to ...
0
votes
0answers
10 views

convergence problems of glmer for continuous response data

I have two questions about implemetation og generalized linear mixed models for continuous response variable in R: I am trying to fit glmm models for a continuous response variable that has a right ...
1
vote
0answers
16 views

Comparing factor structure to network analysis using a community detection algorithm

I am interested in the use of weighted correlational network analysis to explore high dimensional data, instead of latent variable models like exploratory factor analysis (EFA). My approach is to: ...
0
votes
0answers
32 views

How to perform a user defined hypothesis testing on regression coefficient uisng R? [on hold]

i Performed a multiple regression uisng R the regression equation is , USRevenue = (beta0 )+ (beta1)Budget + (beta2)Opening + (beta3)Theaters after that i want to test the folowing hypothesis .. ...
1
vote
0answers
8 views

Generate NBINGARCH in R

Could someone help me show or suggest how to generate data from negative binomial Garch (NBINGARCH(1,1)) model and how to write find the parameters using MLE ? Thank you so much
0
votes
0answers
12 views

Growth mixture modeling with latent variables in R with lcmm

I am trying to replicate the analysis that was used to make this figure: I have measured the depression levels (a quantitative variable) in my subjects at the following time points (in months): ...
2
votes
1answer
40 views

Simulating Random Vector X in R to Confirm with Example that cov(AX) = A cov(X) A'

As has been answered previously, the proof of cov(AX) = A cov(X) A' with X being a random vector and ...
1
vote
0answers
51 views

Interpreting regression results

I computed the following regression using R. ...
0
votes
0answers
20 views

Clustering data with one feature

Is there any built in method to cluster data with one categorical dimension in R? Basically, I have a data set including week of the year and if an event happened in that week. I wanted to use ...
0
votes
0answers
12 views

Estimating Mutual Information using R

I am trying to estimate the mutual information between vit level (values vary from 4 to 70, all of which are whole numbers) and a binary variable that indicates the presence of polyps. I am not sure ...
0
votes
0answers
12 views

How to report the group means and TukeyHSD for an ANOVA without intercept in R? [on hold]

I would like to run a Two-Way ANOVA without the intercept, and be able to report the grand and group means, and run TukeyHSD. However, I would receive this error. ...
0
votes
1answer
7 views

Computing the predicted value from a panel data model with the plm R package

I am estimating the following panel data twoways fixed effect model: y = alfa*y.lag + beta1*z + beta2*z^2 + theta*id + gamma*t (1) where ...
0
votes
0answers
15 views

out-of-sample variance calculation using rolling window in R

My objective is to calculate out-of-sample variance of various portfolios. I am currently working on the comparison of the constructed portfolios using ...
1
vote
0answers
23 views

Neural Network-Fitted values [on hold]

I need to train a Neural network on a set of data. I used several different packages in R, like 'nnet', 'neuralnet', 'elmNN'. I'm looking for a way to do it in R so that I can access all the weights ...
0
votes
0answers
30 views

Predict out of sample values for support vector machine

I wonder how I can use the results for svm() in R for out of sample predictions. Assume that we split the dataset into train and test sets and use ...
0
votes
1answer
27 views

Copula for multivariate distributions

Is anyone know how to join two multivariate distributions using copulas in r. For example let $X=f(x_1,x_2, \ldots,x_n)$, $Y=f(y_1,y_2,\ldots,y_n)$ I need to find a copula for joining $X$ and $Y$ ...
0
votes
0answers
15 views
1
vote
1answer
62 views

Probability help needed

I have a R data frame (>2000 obs) ...
1
vote
1answer
127 views

R Time Series Analysis forecast result always remains same

I am trying to do time series analysis in R. I have data time series data set like this. ...
0
votes
0answers
9 views

Including class probabilities might skew a model in caret?

I've been training SVMs over some particular data for some time. I was quite happy with the Kappa and Accuracy measures caret gives, but adding some other metrics was not a bad idea at all. The thing ...
1
vote
0answers
28 views

How to simulate data in R given mean, median, and range?

I would like to simulate n numbers (all within the range between a and b, n being an even number) using R, and the mean (u) and median (m) is given. If I use runif then the standard deviation is ...
0
votes
0answers
7 views

Indicator species analysis in R (labdsv package) [migrated]

I am trying to do indicator species analysis in R using the labdsv package. I was able to get it to work on previous sequencing data set but now it has thrown ...
0
votes
0answers
20 views

Specification of mixed model structure in glmmLasso

I am having difficulties specifying the appropriate structure for nested/random effects in a mixed model that I am trying to pass through the 'Lasso' shrinkage algorithm. I am using the package ...
0
votes
0answers
10 views

R: dichotomous time interaction in a Cox model

I am using the Cox proportional hazards model to estimate adjusted hazards ratios for survival data. My main effect violates the proportional hazards assumption. I understand there are several ...
1
vote
0answers
7 views

Data frame manoeuvre [migrated]

Suppose I have the following dataframe: ...
0
votes
1answer
26 views

H2O's deep learning on R has a confusion matrix problem…?

I am testing H2O's deep learning in comparison with random forest in R. When I used (1) IRIS dataset [150 observations/samples by 4 predictors/features; the last column shows the class labels (iris ...
0
votes
0answers
10 views

How to calculate linearized rate of postoperative complications in % patient/year in r [on hold]

Linearized rate is a method summarise constant hazard function in a very simple way and defined as: total number of observed events divided by total patients-year (person-year). These rates should be ...
1
vote
0answers
35 views

Fit and evaluate a second order transition matrix (Markov Process) in R?

I already built 1 first order discrete state Markov Chain model. It was built with R using the function 'markovchainFit()' in ...
0
votes
0answers
19 views

Phi correlation for multiple cells

I have this table for chi-square in R: x <- matrix(c(23,22,10,14,11,12),ncol=3) phi(x) this is a 3 by 2 table and thus phi correlation won't work here, can ...
0
votes
0answers
27 views

Modelling proportional hazards in Cox Model using coxph in R

Assume I have a heterogeneous sample with two categorical variables A and B, each with 2 levels. Now I want to measure the effect of these on the survival function. So we assume proportional hazard, ...
1
vote
0answers
21 views

How do I plot an abline() when I don't have any data points (in R) [migrated]

I have to plot a few different simple linear models on a chart, the main point being to comment on them. I have no data for the models. I can't get R to create a plot with appropriate axes, i.e. I ...
3
votes
1answer
40 views

Introductory data trend analysis with R [on hold]

I am new to the data analysis world and am struggling to find relevant articles / examples related to what I'm trying to do. I have a data set that is like this, for example how many apples are sold ...
2
votes
1answer
41 views

Best way to deal with heteroscedasticity in R?

Originally posted on stackexchange but I was told that it fits better here. I have a plot of residual values of a linear model in function of the fitted values where the heteroscedasticity is very ...
1
vote
0answers
20 views

Best way to deal with heteroscedasticity in R?

I have a plot of residual values of a linear model in function of the fitted values where the heteroscedasticity is very clear. However I'm not sure how I should proceed now because as far as I ...
2
votes
1answer
43 views

R Own Implementation of Cross Correlation using Convolution

I try to implement my own cross correlation function in R by translating it as a convolution problem. Part I: So I have two arrays, e.g. two identical arrays, and I want to get the cross correlation ...
1
vote
0answers
95 views

^ symbol in lm() in R [migrated]

I asked this question in Stack Overflow: http://stackoverflow.com/questions/29710525/symbol-in-r-lm I feel like here would be a better place to get an answer. What exactly does the ^ symbol do to the ...
0
votes
0answers
13 views

How to allocate questions to factors using R output?

I have the R output below, but don't know how to allocate questions to the factors. Any advice? ...
0
votes
0answers
10 views

Frequency analysis from time dependent data in R

I've got a time dependent data from animal recording. My data has two groups (TR and UT) each group has 20 replicate. Tiempo (time) variable goes from 282 sec to 318 sec. I have a turning point at 300 ...
0
votes
1answer
30 views

What is the baseline level in a factor-by-factor interaction?

What is the baseline level for a factor-by-factor interaction term in multiple regression? Consider this example from Fox 2003. In the regression below, these two variables are categorical: ...