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
vote
1answer
454 views

Use predicted values with or without random part to plot Residuals with binnedplot of a logistic regression in glmer (lme4 package) in R?

Which binnedplot of the glmer should I use to check the model? The residuals against the predicted values without random part(REform=NA) or residuals against the predicted values with random ...
2
votes
1answer
164 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
1answer
15 views

Correlation between a numeric and factor in R [duplicate]

I'm new to R and I'm trying to find the correlation between a numeric variable and a factor one. I have a data frame with the following 3 columns: 1. nr of clicks (range 0:14) 2. response (1= "YES", ...
3
votes
1answer
14 views

Best practice for ADF/KPSS unit root testing sequence?

I've been quite confused by the various unit root testing strategies recommended in the literature, so I was hoping others may have some advice on the best way to proceed using ADF and KPSS tests. ...
1
vote
0answers
12 views

Approaches to high dimension pattern matching problem [migrated]

My apologies in advance as I am new to this. I have searched the internet and tried various processes and nothing seems to work or address this situation. I have a dataset of 30,000 transactions and ...
2
votes
0answers
15 views

How to estimate the percent of the variation of a time series explained by another time series (non-stationary)?

I've been learning about time series analysis because I want to understand how much groundwater level changes in an aquifer affect land subsidence (land sinking). I have two time series: (1) ...
1
vote
0answers
12 views

Using the confidence intervals to improve predictive model success rate

I'm trying to build a binomial predictive model based on glm. My overall prediction is very low, in the order of 60%. But when I go for the datapoints that have the both boundaries in one side, for ...
1
vote
1answer
360 views

How to find conditional probability P(X<x|Y=y) using copulas?

I am trying to find conditional probability of the form P(X<x|Y=y) for two jointly distributed random variables based on the copula estimate from training data. ...
0
votes
0answers
9 views

How to make all interactions in R before using glmnet [migrated]

I have an x-matrix of 8 columns. I want to run glmnet to do a lasso regression. I know I need to call: glmnet(x, y, family = "binomial", ...). However, how do I get x to consider all one way ...
1
vote
0answers
11 views

Is smooth.spline appropriate for presenting the trend of chemical concentration in a catchment

In my case,the Electrical Conductivity (EC) values are measured daily in some pints of catchment from 2007 to 2014, and around 20% data are missed, due to without probe or flux. To presenting the ...
1
vote
1answer
38 views

Density plot of parameter estimates from linear regression model

I am running a linear regression model in R: data(iris) fit1.iris = lm(Sepal.Length ~ Petal.Length+Petal.Width , data=iris) summary(fit1.iris) These are my ...
0
votes
1answer
49 views

Cronbach's alpha in R

I am pretty new to Cronbach's Alpha, so I have a question about how to find it using R. As far as I am aware, Cronbach's alpha is a measure of internal consistency, but to use the alpha() function in ...
3
votes
1answer
74 views

Monte carlo simulation in R

I am trying to solve the following exercise but I actually have no clue on how to start doing this. I've found some code in my book that looks like it but it's a completely different exercise and I ...
0
votes
0answers
7 views

Why will higher order of polynomials using poly() function solve in lme model and lower orders won't?

I am modeling repeated blood pressure data over 24-h (300 patients, 13,000 observations) and have fit the following model with 9th order polynomial which has solved: ...
2
votes
1answer
321 views

How to fit a simple count time series INAR(1) model

I am trying to perform a simple time series analysis with count time series data. My data is a sequence of small integer values like 0,1,2 and 3. I learned from various sources that INAR model would ...
1
vote
0answers
20 views

R random forest on Amazon ec2 Error: cannot allocate vector of size 5.4 Gb [migrated]

I'm training random forest models in R using randomForest() with 1000 trees and data.frames with about 20 predictors and 600K rows. On my laptop everything works fine but when I move to amazon ec2 to ...
1
vote
0answers
38 views

Multiple Imputation - Help Needed

These multiple imputation results relate to data I have previously described and shown here - Skewed Distributions for Logistic Regression Three variables I am using have missing data. Their names, ...
5
votes
2answers
141 views

Skewed Distributions for Logistic Regression

I have been developing a logistic regression model based on retrospective data from a national trauma database of head injury in the UK. The key outcome is 30 day mortality (denoted as ...
0
votes
0answers
24 views

Kruskal–Wallis non-parametric alternatives for groups with different shaped distributions

My question does't duplicate this question, even if the titles are nearly similar. The Kruskal–Wallis test "assume that the observations in each group come from populations with the same shape of ...
0
votes
1answer
76 views

How to get Sub-Training and Sub-Test from cross validation in Caret

I am using Caret function I have divided my data into training(75%) and test (25%) sets. Now I am running 10-Fold CV on training data. When i fit following model train_control <- ...
0
votes
1answer
69 views

In a neural network of n features which predict a continuous variable X, how to tell the feature which contributes the most to the output value X?

Say I have a neural network which uses some input features say N, some inut layers say L which predict a continous variable say X. Can we say which features or combination of 2 features of the initial ...
0
votes
0answers
12 views

How to find rows of a given matrix that satisfy a certain property? [migrated]

Suppose that I have a 90x4 matrix, say matrixgroup1, and some of rows are zero vectors. I want to find the rows that are not zero vectors. The code that I try was: ...
3
votes
1answer
106 views

Predicting customer churn - train & test sets

I'm struggling with a problem where I'm trying to predict customer churn. I have monthly snapshot data going back several years, and tags for whether a customer left during a given month. My main ...
1
vote
1answer
67 views

Missing factor levels after logistic regression glm()

I am quite new in the R universe, so please excuse me if the question is too simple.. I would like to perform a logistic regression on a marketing data set (only categorical variables), of the form ...
1
vote
1answer
98 views

Using OLS for Model Selection and Prediction - Heteroscedasticity Issue

I am new to regression and having problem in solving Heteroscedasticity in OLS. Have done lots of homework and test before seeking your advice. Sharing the background and what I have done to solve the ...
1
vote
2answers
35 views

Classification Algorithms

Rather than due a google search and hope to find "the best" or an exhaustive list of classification algorithms I thought it might be easier to pose my questions here, and then get advice from you ...
2
votes
1answer
42 views

Recommendation: Fast algorithm for logistic random effects?

What is the fastest algorithm for fitting a simple logistic 'random effects' type model, with only one level of categorical predictors? Another way of putting it might be a logistic regression with ...
0
votes
0answers
21 views

Model failed to converge

I'm doing a variable selection for the interaction gender:type2 now ...
0
votes
0answers
6 views

How to keep modified/downloaded package [migrated]

R noobie here. I'm am trying to use a package that I download off of github using source_gist, but it appears that I need to re-download it every time I quit R ...
3
votes
3answers
135 views

Difference in PCA loadings between R and SPSS

I performed two principal components analyses: in R and in SPSS - using the same dataset and the same variables. I got the same results - at least to some point. The eigenvalues are the same (I used ...
0
votes
0answers
23 views

Why does NSDIFFS (R forecast package) never show seasonality? [migrated]

I've been using the EViews statconn DCOM interface to loop a large number of series from FRED through the nsdiffs(test=c("ch")) function in the forecast package of R to examine what percent of them ...
0
votes
1answer
29 views

Is high AIC a bad feature of the model?

I have a model with AIC equal to 78 809. Does this mean this is a very bad model or the intepretation should be different? There are 15 variables, 2-level response variable and 40 000 rows. ...
1
vote
1answer
147 views

Netflix Challenge - some help with SVD/SoftImpute

I'm currently working on the Netflix Challenge with the original huge dataset and have run into some problems. I don't have access to any servers or computing clusters so I've been running everything ...
1
vote
1answer
43 views

Learner in R to predict data from a complex function: if a>b then a*b else a+b

What sort of general purpose learner could learn the data generated by the following function: if a>b then a*b else a+b or something of that sort of complexity. Ideally something general enough to be ...
0
votes
0answers
14 views

Is there a non-parametric repeated measures test for replicated block data?

Following on from an earlier question, I've got another question about comparing machine learning classifiers on various datasets. From the response to that question, and also to this paper I ...
0
votes
0answers
17 views

Forcing the order of variable in a decision tree in R [migrated]

I would like to build a decision tree in R. Is there a function or workaround, to specify the order of the variables in the tree? For example if A, B and C are inputs I would like to say: split first ...
0
votes
0answers
8 views

Poisson glm overdispersion. Calculating QAICc for model comparison

I'm having some difficulties with my glm . The models are overdispersed so I want to run them as quasipoisson. I would like to be able to compare the models using QAICc but the packages I have ...
0
votes
0answers
16 views

Auto-correlation vs. number of observation periods

I've just read an excellent post mix model I've a question connected to that. Roland, can you recommend any reference to a comment that if one have not enough observation periods then it is ...
3
votes
1answer
156 views

SVM in R package e1071

I am trying to use SVM to make a prediction (True or False) on a dataset with many independent variables. I am wondering how I can identify the most useful variable in making the prediction. I ...
4
votes
2answers
60 views

What information, if any, can I extract from this scattermatrix?

I'm playing around with the breast cancer dataset and created a scatterplot of all attributes to get an idea for which ones have the most effect on predicting the class ...
2
votes
1answer
425 views

R package TSA: how to interpret the IO coefficients output of the arimax function

I was playing with the TSA package in R and wanted to test the arimax function to the solution provided in Pankratz's Forecasting with Dynamic Regression Models, ...
1
vote
0answers
11 views

R function equal to excel CHIINV [migrated]

I'm looking for a function which do the same thing as excel's CHIINV. From Microsoft documentation, the definition of CHIINV is Returns the inverse of the right-tailed probability of the chi-squared ...
0
votes
1answer
25 views

Importance of McNemar test in caret::confusionMatrix

There are many metrics to evaluate the performance of predictive model. Many of these appear relatively straightforward to me (e.g. Accuracy, Kappa, AUC-ROC, etc.) but I am uncertain regarding the ...
0
votes
0answers
17 views

What type of post hoc test does a LME use by default?

I need to know what type of post hoc test a LME model is using in R, by default? Is it Tukey? And is the alpha modified?
6
votes
3answers
845 views

Document classification with naive Bayes algorithm

I want to build a document classifier in R, using the Naive Bayes approach. Here are steps, that I've done so far: I have corpus with about 30 documents from 2 authors (Classes are: "target author" ...
4
votes
1answer
290 views

Generate two variables with precise pre-specified correlation

I want to generate two variables with (pseudo-) random numbers with an exact pearson's r. How do I do that? Python and/or R solutions would be nice! I am able to generate random data that ...
0
votes
0answers
9 views

Diference between glm and bigglm estimates

How does bigglm function in biglm package work for logistic regression? I thought that it is not possible to calculate LR on chunks of data and then merge results. Will glm and bigglm yield ...
10
votes
2answers
139 views

r-squared in quantile regression

I am using quantile regression to find predictors of 90th percentile of my data. I am doing this in R using the quantreg package. How can I determine $r^2$ for ...
6
votes
1answer
653 views

“Kernel density estimation” is a convolution of what?

I am trying to get a better understanding of kernel density estimation. Using the definition from Wikipedia: https://en.wikipedia.org/wiki/Kernel_density_estimation#Definition $ \hat{f_h}(x) = ...
0
votes
0answers
13 views

Can a factor be used as Y variable? Best test? [duplicate]

I have many plant populations of the same species sampled (around 100). What is measured is an allele on one gene, that can be A,B or C. This is what I would like to use as Y variable. Then I have the ...