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

R auto.arima for two datasets - what am I missing?

I have one dataset on newspaper articles about crime, and another dataset on crime reported on the police. The data are daily, covering about six months. I want to try an ARIMA model on these ...
0
votes
0answers
8 views

Print significant auto-correlation value in R

If I do an autocorrelation test in R (acf), I get a great graph, and the horizontal lines show the cutoff of significance. acf also prints out the individual lag values in the console, however, here ...
0
votes
0answers
3 views

A linear model for testing difference in pairs value between two groups

I have the following experimental design: Values of expression of 3 genes taken from 3 different patients and 3 different controls. R code for generating these data: ...
0
votes
0answers
15 views

Missing Data (mice) and Survey Package r

First, I am new to analyzing public opinion polls and the r package "Survey". I would like some advice. I am running a regression model with weights from a Pew survey, however, I noticed that a ...
0
votes
0answers
8 views

Use of data not captured in a survey for survey glm model

A former statistician in my organization carried out a survey to understand customer satisfaction using stratified sampling. On arriving at the organization, I was interested in seeing how variables ...
0
votes
0answers
10 views

Supervised HMM Training in R

I'm looking for an R package that implements the supervised training of Hidden Markov Models. By supervised, I mean given a sequence of observations, we know which ...
0
votes
0answers
13 views

plotting a three way interaction in an lmer model using r

I have a significant three way interaction between three continuous variables (frequency, exposure, and density) in a linear mixed effects model. I'd like to understand the nature of the effect by ...
0
votes
0answers
6 views

How to interpret clmm output

I am using the clmm() function from the R package ordinal. I understand that the ...
2
votes
0answers
17 views

Confidence interval of linear regression variable calculation [duplicate]

I want to be able to calculate the confidence interval from the estimated coefficient and respective standard errors. I have a linear regression model which can be summarized (in R): ...
0
votes
0answers
9 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
20 views

Results of xgboost binary logistic regression in R

I am having problems running logistic regression with the xgboost package. My code (the dataset is not the classic iris dataset): ...
-1
votes
0answers
22 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
1answer
35 views

Computing Cross-Validation Errors for Subset Selection: question about standard code in the literature

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 (regsubsets returns the "best" ...
0
votes
0answers
10 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
13 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
23 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
19 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
19 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
30 views
1
vote
1answer
38 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 ...
1
vote
0answers
23 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
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
17 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
9 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
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
31 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 ...
2
votes
0answers
31 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
26 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
52 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
23 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
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
27 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
34 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
14 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
20 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
50 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
37 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: ...