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

3
votes
0answers
34 views
+50

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
32 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
22 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
20 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
33 views

How to forecast daily sales of multiple items?

...
1
vote
1answer
46 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
14 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
33 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
23 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 ...
3
votes
1answer
38 views

Cross-correlation of two autocorrelated signals (removing autocorrelation 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 ...
0
votes
0answers
11 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
23 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
10 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
40 views

plz anyone can write commands of this barplot thanks in advance [on hold]

Need comands of this barplot in r packege
0
votes
0answers
21 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
33 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
14 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
48 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 ...
3
votes
0answers
35 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 sound methodological ...
0
votes
0answers
36 views

Error using lrm function with factor [closed]

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
54 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
26 views

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

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
15 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
28 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
18 views

Two-stage sampling with R [closed]

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
36 views

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

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
15 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? [closed]

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
14 views

Principal Component Regression In R using Caret [closed]

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
21 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? [closed]

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
59 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
39 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? [closed]

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
32 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
44 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 [closed]

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 ...
0
votes
0answers
15 views

Constrained Least Squares in R [closed]

Alright so I am trying to setup a constrained least squares problem (which is quite simple) in R but I am having issues and thought people here might be able to help. Here is the problem: $min_P ...
0
votes
0answers
20 views

testing nonlinear hypothesis glm R

I estimate probit model: \begin{align*} P(y=1|x_1, x_2, x_3) = \Phi(\alpha_0 + \alpha_1 x_1 + \alpha_2 x_2+ \alpha_3 x_3) \end{align*} using: ...
0
votes
1answer
34 views

Hierarchical Cluster Analysis: similar to market basket and how to implement in R? [closed]

This is a simple cluster analysis question, but I've not done much clustering at all, so any help would be appreciated. I have N items and there are M people, each picking some of these N items. I ...
0
votes
0answers
24 views

how to normalize demand/availability matrix for Citibike data

I am not a statistician but would appreciate an outside perspective on my current project analyzing citibike data. This is a bit complicated so please bear with me. My goal is to determine to what ...
0
votes
0answers
12 views

The difference between pvclust and hclust functions in R

Why pvclust is clustering the coloumns while hclust is clustering the rows. I am confused since pvclust function uses hclust for clustering. I tried both function with the same dataset, but the ...