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

0
votes
0answers
5 views

Propensity score matching - Force full match on specific categorical variable

I'm trying to perform propensity score matching using R MatchIt pacakage, and I have a question: I have tried the nearest neigbor method, and I understand that it tries to find the nearest match, in ...
0
votes
0answers
9 views

Results of xgboost binary logistic regression in R

I am having problems running logistic regression with xgboost My code (the dataset is not the classic iris dataset) ...
0
votes
0answers
17 views

How to find the 1000 closest point to a centroid built from another matrix

I actually work on text-mining. I try to find the 1000 closest documents (inside a corpus of 56000 documents) to a selected corpus of document (150). There are a lot of words in my dictionary. I ...
1
vote
0answers
8 views

Computing Cross-Validation Errors for Subset Selection: confused about standard code in the literature and online

I am currently trying to understand how to use cross-validation in order to choose among the 'best' subsets of different sizes returned by the R function regsubsets. I found in p250 of Introduction to ...
0
votes
0answers
6 views

Calculate the non centrality parameter (ncp) for non central chi squared distribution

I have the 0.975-quantile value (0.191) and the degree of freedom (k=1). How can i calculate the non centrality parameter ? in R if possible. Q0.975(k=1, ncp= ??) = 0.191
1
vote
0answers
9 views

When does pam (partition around medoids) fails to find the optimal solution? (counter example?!)

If I understand correctly, the pam algorithm is a greedy search for a set of medoids such that no other set offers a lower cost (i.e.: the sum of distances of points to their nearest medoid). ...
1
vote
0answers
19 views

Probability of a point fitting a line

I am trying to classify between two groups a set of points given two variables (size of the space = L and points of the space occupied = N). At the moment I have a sample size of 620 samples with ...
0
votes
1answer
14 views

Computing the Interaction gain. Is there an Error in the infotheo package in R?

In order to implementing a certain feature selection method for a classification problem I need to estimate the the interaction the interaction gain between two features and the target variable which ...
0
votes
0answers
15 views

R Commander: how to test correlation across all variables? [on hold]

If I want to test correlation between two variables I would run the following command in R: ...
1
vote
0answers
20 views

How to forecast daily sales of multiple items?

...
0
votes
0answers
18 views

How to choose factors in constrained Linear models?

I was trying to do a linear model analysis where the parameters are constrained (sum to 1 and non-negative).But I found that is not obvious how to apply AIC function(or others) to the parameters ...
-1
votes
0answers
11 views

Convert melted/long format to wide in R [on hold]

Please the the problem on the picture. I had to convert wide to long to perform rolling averages to engineer metrics, but now I need to put it back to wide format. Not sure how to do this in R. ...
0
votes
1answer
29 views

Complete separation and stepwise regression - possible in R?

I've been using stepAIC to narrow down my logistic regression model. However, I get the following warning when I run my model: glm.fit: fitted probabilities numerically 0 or 1 occurred I know this ...
1
vote
0answers
19 views

Predicting Barometric Pressure Based on Wind

I'm working on a script that populates missing Pressure values based on Wind using R's lm(). In the NOAA HURDAT dataset, a large chunk of the pressure values are ...
1
vote
0answers
13 views

Cross-correlation of two autocorrelated signals (removing acf with arima)

I want to get the cross-correlation of two time series x and y in R. I have calculated an arima model, and I can get the mod1$residuals from signal x. These residuals almost have no acf, so that's ...
0
votes
0answers
8 views

find probability of occurrence of events from a matrix and populate it to another matrix

I have a matrix as following that shows the actions and current states and next states in a Markov model. ...
0
votes
1answer
15 views

randomForest MDSplot help R

I am new to R and randomForests so bear with me. I am trying to visualise my randomForest a little better using the MDSplot() function in Random Forest. There are two things i would like to do, and i ...
0
votes
0answers
8 views

cross validation GAM in Program R

I have performed a cross validation on a GAM model and have the following output: eval = CVgam(formula = time1 ~ strata(bout) + s(UNOBSTRUCTED_CHANNEL_WIDTH_FT),data = dat, nfold = 55, debug.level ...
-3
votes
0answers
37 views
0
votes
0answers
18 views

How to generate conditioned random variables from a density function?

I want to generate random variables from a distribution function using inverse sampling with the additional condition that the sampling should be conditioned, i.e., random generated variables should ...
0
votes
0answers
29 views

Build HMM of text data in R

I'm trying to make my own HMM tagging in R but don't know how to estimate parameter values since the packages I have been working with haven't worked with my data. The latest package I have been ...
1
vote
1answer
13 views

Categorical variable as control variable in MatchIt

I'm kind of new to R and trying to run propensity score matching using the MatchIt module. Some of my control variables are continous but some of them are categorical. For example, I have a "currency" ...
0
votes
2answers
47 views

Statistical test to compare skewed distributions of binary data

I have two positively skewed distributions of binary data (0, 1) I would like to compare. I'm not an expert of non normal distributions. Is there a statistical (R based) test to do this? Thanks in ...
1
vote
0answers
18 views

Regression discontinuity design

I am trying to apply an RRD design to a set of spatial data from rasters. The approach has been widely used in the development economics literature and I know that it is a good methodological ...
0
votes
0answers
24 views

Error using lrm function with factor [on hold]

When I try to use the lrm function from the rms package I get the following error when I add a factor Error in X[, ...
2
votes
0answers
51 views

Scatter plot with two factor variables for black and white print

How can I best represent a scatter plot with two different factor variables. Consider the example problem, ...
1
vote
0answers
24 views

R: how to plot a cox regression model survival curves (treated vs control curves) using ggplot2? [migrated]

I have a cox model in R that shows time to diabetes. The formula is: ...
-3
votes
0answers
22 views

R. Change som data points (In one column I want to change all the 0's to1) [on hold]

I have a dataset in R. In one column I want to change all the 0's to 1. How do I do that. Some kind of 'if' loop I suppose?
0
votes
0answers
13 views

Forecasting using ARIMA when data available in interval of seconds

I want to use ARIMA for forecasting website visits after some fixed amount of seconds, say 100 seconds. I have csv file available that contain two columns; one is the time and another is the visits, ...
1
vote
0answers
24 views

How to plot a Semantic Differential profile in R? [on hold]

It looks like it's a problem to find R code for plotting a Semantic Differential profile. The only I hardly found: https://github.com/justineuro/sdRplot. Here is the output example, visit . But it ...
0
votes
0answers
16 views

Two-stage sampling with R [on hold]

I have been trying to do a two-stage survey sampling using the mstage function. My sampling frame consists of 23 primary sampling units (...
0
votes
1answer
33 views

Having trouble making a scatterplot out of my data in R studio. [on hold]

As the title says. Instead of a typical scatterplot with an x and y axis, I get something with a third increment on the right side of the graph. What am I doing wrong?
0
votes
0answers
10 views

SMOTE algorithm how to select over and under percentage?

I have a highly unbalanced binary dependent variable (i.e. cases of '1' is <5%). I am trying to implement SMOTE algorithm using R DMwR package. I wonder in general, how we determine the parameters ...
0
votes
0answers
20 views

What is the best way to optimize API implementation order? [on hold]

I am working on an emulator and would like to build API support in the most beneficial order. Assuming I have a scored list of applications and know which APIs they each use, what is the best way to ...
0
votes
0answers
12 views

Principal Component Regression In R using Caret [on hold]

I am trying to build a model using Principal components Regression. I first build the model on the training data set using the Caret package : ...
0
votes
1answer
19 views

Assessing Repeatability of a Multivariate Measurement

I have a measurement that was taken 10 times on a sample. The measurement has roughly 11K points. If you're curious, I'm looking at mass spectrum data. I want to determine the repeatability of the ...
0
votes
0answers
10 views

R: How to pack the seasonal components of time-series to an array-like structure? [on hold]

I am trying to calculate the decomposition of 34 time-series to study the similarity of seasonal components, as explains this this tutorial I start from a CSV that, after some transformations and ...
1
vote
1answer
25 views

Neural network - continuous vs. non continuous variables

I'm using the neuralnet package in R to attempt to predict the median value of Sales using all the other variables of the data ...
2
votes
0answers
26 views

Testing for white noise for non stationary time series

I could not find a question where testing for white noise for non strick stationary non parametric time series is adressed. Per definition white noise is stationary. But finding a series that is ...
2
votes
2answers
46 views

Meta analysis across studies with multiple response measures

I'm trying to do a meta analysis across a bunch of bird playback studies. Thanks to help on a previous post here I'm fairly certain I need to use inverse variance weighting (maybe with the 'meta' ...
0
votes
1answer
36 views

Best fit with GLM in R

I'm trying to know what is the best GLM fit with this simple dataset and tests in R: ...
8
votes
2answers
1k views

What is this type of plot called with side-by-side centered horizontal density bars?

What would you call this type of plot, and is it possible to create them in R? EDIT: many thanks all - very helpful. Best title so far: quantised violin plots!
0
votes
0answers
19 views

How to test the significant difference of two confusion matrices? [duplicate]

Is there a test for testing the difference between two confusion matrices?
0
votes
0answers
18 views

How to calculate multi class classification AUC with labels? [on hold]

I am using pROC (in R) with the function multiclass.roc as pointed out at the thread How to plot ROC curves in multiclass classification? However, when I applied ...
1
vote
1answer
31 views

Slight difference in output of SAS proc genmod and R glm

I am trying to reproduce a model fit using SAS proc genmod in R glm and am able to get the same estimates and SE's for all parameters except the intercept and Distance coefficient. SAS: ...
0
votes
0answers
42 views

Understanding the Output of ANOVA in R

I have one response variable $Y$ and one predictor $X$. I am trying to fit a polynomial regression model and try to compare different model with different highest power term, the output of ANOVA in R ...
0
votes
0answers
37 views

Compute the % using SD, and Mean

Compute the percentage of crime rates that fall within one sample standard deviation of the sample mean So I have this data called 'crime rates' and I want to answer the question above, and as ...
0
votes
0answers
13 views

How do you test for departure from linear trend across ordered categorical variables with logistic regression using R? [migrated]

I'm testing for a linear trend in the log odds of a binary outcome across an ordered categorical independent variable. This is straightforwardly achieved by treating the independent variable as ...
-2
votes
0answers
23 views

R fitdistrplus : Seek help in understanding NA in std error [on hold]

I am trying to fit a negative binomial distribution and I am using the following piece of code: ...
0
votes
0answers
11 views

Logistic Regression and possibly over fitting the model [duplicate]

I have run the below model, with a binary outcome on class and multiple predictors. When I run the predictor pre_class as a binary outcome (it is originally ordinal ...