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

0
votes
0answers
3 views

Which Test to Use?

I was wondering if someone could help me regarding the statistical tests I should use. Basically I have the following: 1) I carried out a survey asking teachers and students to rank components in my ...
0
votes
0answers
3 views

How to use Hartemink's discretization algorithm?

From the help documentation of the discretize function of the R package bnlearn: Hartemink's algorithm has been designed to ...
0
votes
1answer
22 views

Survival Analysis in R with Grouped Data

I'm just getting started with survival analysis and I'm having trouble finding something in R that will do what I'm looking for. Most of the packages use survival ...
4
votes
1answer
120 views

Forecasting high frequency variable with low frequency predictor

Newbie here to forecasting and I have a very basic question. I have 2 distinct time-series data. Time Series A is Weekly (High frequency) Time Series B is Monthly (Low frequency) I need to ...
0
votes
0answers
8 views

How to extract the importance of predictors in Adaptive boosting?

I have trained a boosting classifier using ada package in R. Now I want to see the importance of my predictors in constructing ...
2
votes
1answer
704 views

Non-parametric test for repeated measures and post-hoc single comparisons in R?

Some attribute $x$ of 17 individuals was recorded repeatedly on 6 time points using a Likert scale with 7 distractors. Which statistical test(s) can I apply to check whether the changes along the 6 ...
2
votes
0answers
13 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
2answers
245 views

Generating values from copula using copula package in R

I have a bunch of questions concerning the use of the copula package in R. My overall aim is to generate synthetic values using copulas. I am analyzing a hydrological data: annual peak discharge ...
6
votes
5answers
294 views

R2jags does not remove the burn in part sometimes?

I found out that the function jags() in the R2jags package sometimes does not remove the burn in part even with the option ...
0
votes
0answers
7 views

Neighbours list extracted out of polygon regions [migrated]

I've got a SQL database which contains some coded polygon structures. Those can be extracted as follows ...
0
votes
0answers
60 views
+50

How to perform proper data mining on time-series data?

I have some daily data from city A, B, C. Values from city A are highly correlated with values from other cities for lag -1,-2,-3 and -4. I want to use Random Forest, SVM and ANN to predict values ...
0
votes
1answer
130 views

Finding the state for Markov chain in R based on a generated sample

I am looking for a R code of discrete Markov chains. I have done the following: ...
0
votes
1answer
33 views

clustering high dimentional data (p > n) in R

I have a situation where we have a number of quantitative features / variables (p) than the number of samples (n). My objective is to classify these samples into groups (may be hierarchical). I can ...
0
votes
0answers
22 views

Problem when doing pre-whitening before ccf analysis

I have following R code which does not work when trying to pre-whiten other series by the model generated for the other series. -- Libraries; library(forecast); library(TSA); library(xts); -- Read ...
0
votes
0answers
9 views

Introduce lag term in formula using dlnm package

I am using the dlnm package to build a finite distribute lag linear model. I intend on testing the model-fit based on various lag levels to assess which lag is ...
0
votes
0answers
19 views

lmlasso does not work for p>n

I am using the following example from the R manual: ...
1
vote
1answer
35 views

Does Boruta feature selection (in R) take into account the correlation between variables?

I am a bit of a novice in R and feature selection, and have tried the Boruta package to select (diminish) my number of variables (n= 40). I thought that this method also took into account the possible ...
1
vote
0answers
17 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
26 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
10 views

Leave-one-subject-out cross validation in Caret

Hi Dear Colleagues, I wonder how to correctly setup a leave-one-subject-out cross validation (LOSO) for train() function in caret. Here is my example code: ...
3
votes
3answers
159 views
+200

ARIMA Intervention Transfer Function - How to Visualize the Effect

I have a monthly time series with an intervention and I would like to quantify the effect of this intervention on the outcome. I realize the series is rather short and the effect is not yet concluded. ...
0
votes
1answer
50 views

hclust, R and Euclidean distances: weird stuff

I have a table of similarities expressed through cosines and am trying to do some cluster analysis in R, using hclust and ...
0
votes
0answers
21 views

Sharing a Legend between two combined ggplots [migrated]

I'm currently trying to present two time series using ggplot2, both with very different scales, using two ggplots. I've combined the two separate ggplots, one on top of the other, using ...
0
votes
0answers
45 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
8 views

boosting with ada package. How do I take the most probable answer from predict?

I trained classifier using ada. Now I executed: predict(adaDol,newdata=cords()) and received response: ...
0
votes
0answers
19 views

Can we easily avoid the “maximum supported lag is 350 error” when using the ARIMA function in R? [migrated]

I am currently fitting a SARIMAX model to big data sets. Information is retrieved every 10 minutes, so I have a vector of size 52560 for a year of data. Considering it is representing electricity load ...
0
votes
0answers
17 views

R: Package 'sphet' on spatial autoregressive models

I'm using the function gstslshet from the package sphet in R, but I'm wondering what the outcome is. Is it a model which can be ...
2
votes
1answer
2k views

rpart and the printcp function

I don't really understand how the columns "xerror" and "rel error" are calculated. I found out that the printcp() function "gives cross-validation estimates of misclassication error (xerror), ...
1
vote
1answer
57 views

How to capture & present lm model output from R

After running iterations of lm() in R, I am now stuck with which components of the model's output to present and how to present them. I know that the $R^{2}$ value, ...
0
votes
1answer
53 views

fit nonlinear regression model to data

I was wondering how can I best fit nonlinear regression model to this data, using R package. How can I check if model is good fitted since Rsquared value is not returned in most functions for ...
1
vote
2answers
78 views

Forest plot for meta-analysis displaying the mean ES with and without outliers

I am conducting a meta-analysis and am trying to produce a forest plot displaying the mean weighted effect size with and without the outliers. I looked on so many websites and tried a lot of syntaxes, ...
1
vote
1answer
25 views

Creating a cluster analysis on multiple variables

I am working on creating a cluster analysis for some very basic data in r for Windows [Version 6.1.76]. The groups themselves are countries and then I have 2 column with continuous numerical ...
0
votes
1answer
12 views

Multivariate regression or PCA to reduce response variables?

I hope the title is self-explanatory, but essentially I want to know which method is better: does it make sense to use a PCA to reduce a number of response Y variables and then conduct a univariate ...
3
votes
0answers
58 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?
1
vote
0answers
11 views

R Sales Modeling with Non-Replenishing Inventory

I'm working on modeling sales for tickets for a specific event over time. The issue that I'm having is that the inventory does not replenish, so I can't have my model predicting over what I actually ...
0
votes
1answer
12 views

Caret varImp for randomForest model

I'm having trouble understanding how the varImp function works for a randomForest model with the caret package. In the example ...
2
votes
1answer
14 views

conducting multi-level regression on ordinal DVs with imputed data in R

Do you know of an approach/package that facilitates mixed model regression of ordinal dependent variables on multiply imputed datasets in R? Ideally, the function takes: a list of multiply imputed ...
0
votes
1answer
58 views
+50

R: Fitting a model with periodic, nonlinear and categorical components

Can anyone give me some advice on how to fit a model with linear (some categorical), non-linear and time series components in R? I don't want to use a non-parametric model like a Loess smooth or ...
0
votes
0answers
22 views

R² (squared) from a generalized linear mixed-effects models (GLMM) using a negative binomial distribution

I try to compute the marginal and conditional R² for a GLMM using a negative binomial distribution by following the procedure recommended by Nakagawa & Schielzeth (2013) . Unfortunately, the ...
1
vote
1answer
27 views

Durbin Watson test statistic

I applied the DW test to my regression model in R and I got a DW test statistic of 1.78 and a p-value of 2.2e-16 = 0. Does this mean there is no autocorrelation between the residuals because the ...
1
vote
2answers
36 views

Prediction interval for a fitted log-normal distribution

What I am trying to do is to fit a log-normal distribution to a data-set, and then determine confidence and prediction intervals for the fitted distribution - not just for the mean and sd estimates. ...
1
vote
0answers
31 views

Low explained variance in Random Forest (R randomForest)

I am using randomForest in R for regression, I have many categorical predictors (all of them have the same 3 categories (0,1,2)) and I want to see which of them can predict the response (continuous). ...
1
vote
1answer
14 views

Calculated breeding values using markers using animal model in R

Animal model (frequently used in animal science and sometime in human or plants) is mixed model with: $y$ = $X$$b$ + $Z$$u$ + $e$ y is observed values for any quantitative variable, $Xb$ is fixed ...
0
votes
0answers
14 views

Conditional logistic regression model does not converge but logistic regression model does

I am running an analysis where I have 2500 cases and 2500 controls. The cases have disease A, and the controls do not. I am trying to see if having disease A increases the odds of various diseases. ...
6
votes
1answer
94 views

Relationship between paired t test and simple mixed model

The bounty I placed on this question expires in the next 24 hours. I have a psychological data set which, traditionally, would be analysed using a paired samples t test. The design of the ...
1
vote
2answers
118 views

How to compare the outputs of two algorithms computing SVD?

For example we have 2 algorithms from R: SVD and irlba and I want to compare them int terms of speed,memory and precision. But I don't understand how to compare output of algorithms, they must be ...
0
votes
0answers
26 views

R. function hclust, euclidean distances and cosines

My data is a table of cosines and I want to analyze it with hclust, which works on squared Euclidean distances. shall I do: d <- dist(mydata, method = "euclidean") fit <- hclust(d, ...
1
vote
0answers
32 views

R-squared for linear mixed effects model [duplicate]

I ran linear mixed effects model in R. model<-lmer(yld ~ rain + (1+rain|state),data=data,REML=FALSE) Is there any way I can generate an R-squared for the ...
0
votes
0answers
5 views

Boruta score goes to minus infinity

I'm running the Boruta algorithm with a $179\times 36$ predictor matrix and a numerical response. Most of the variables have a score going to -Inf. Should I ...
0
votes
0answers
3 views