# Questions tagged [r]

R is a free, open-source programming language and software environment for statistical computing, bioinformatics, and graphics.

1,250 questions
Filter by
Sorted by
Tagged with
72 views

### Recommendations for statistical models given my dataset

I'm having a problem when using the k-fold cross-validation with the Random Forest method. One of the outputs is the error "Error in randomForest.default(x, y, mtry = param\$mtry, ...) : Need at least ...
16 views

### How much can I reduce sample size in a bootstrap used for density estimation?

I have a dataset with 90m rows by 10 numeric/boolean columns. I need to calculate bootstrap distributions for 40 statistics. These statistics are definitely not Gaussian (nor similar to the mean of ...
26 views

### how to plot a mixed graph in R?

How can I plot a mixed graph in R? I have used this but doesn't work (in bnlearn he calls 'arc' to a directed edge and 'edge' to an undirected edge): ...
24 views

### Test and Control analysis to measure the impact of Change in sales-rep for territories

I hope you all are doing well. Before I proceed with my problem statement, a few terminologies for reference - Territory = Sales Territory - Think of it like a county/region assigned to a particular ...
1k views

### SMOTE for regression

I am looking into upsampling an imbalanced dataset for a regression problem (Numerical target variables) in python. I attached paper and R package that implement SMOTE for regression, can anyone ...
26 views

### De-Normalizing Predicted Values from Neural Network

When fitting the neural network model I normalized the data using the min/max formula: normalized = (data - min(data)) / (max(data) - min(data)) I fitted the ...
25 views

### How to randomly split the data set into multiple different sets:(training 70%:validation 10%(optional):testing 20%) in R?

I have a dataset with 4 predictor variables X1, X2, X3, X4, and one response variable Y. I have been asked to check the correlation between these variables and see how they are related and then use a ...
129 views

### Which data set to use to find correlation between Predictor and response variables? Test data set? Training data set? or the entire data set?

I have a dataset with 4 predictor variables X1, X2, X3, X4, and one response variable Y. I have been asked to check the correlation between these variables and see how they are related and then use ...
15 views

### Dynamic time warp z score normalisation not working

I have data that looks like this A bit of background, these are soil moisture graphs of different depths. I wish to investigate how long it takes for water to drip down from one depth to another, ...
22 views

### Create graph from 2D grid in R

I have 40 images (256 x 256 vertices-pixels) where each vertex (i,j) has an intensity value corresponding to the weight of the edges of the vertex. For each image I want to create a graph where each ...
21 views

### How to combine three lists of data.frames?

I have been reading over similar questions asked here but the solutions aren't working at all and I cannot work out how to make their examples applicable to me. Any help would be appreciated. I ...
39 views

### Can an entire data frame be used as a prediction variable?

I am attempting to use XGBoost in R to train a model that predicts a fixed number of target variables using all data from previous dates, as well as the two categorical variables (...
43 views

### Group_by 2 variables and pivot_wider distribution based on 2 others

Performing some calculations on a dataframe and stuck trying to calculate a few percentages. Trying to append 3 additional columns added for %POS/NEG/NEU. E.g., the sum of amount col for all ...
27 views

### How to iterate over the rows of a data frame?

I want to perform perform the following operations on a dataFrame in R ...
60 views

### Is it possible to pass dataframes between R and Python using Arrow with zero-copy?

Arrow is an in-memory format, so I can have a dataframe in Python backed by the arrow format. So the dataframe sits in memory, can I use that dataframe directly from R without making a copy of the ...
20 views

### How to group a unique column and find the mean value in a separate column in R

My table of data looks like this image (but with many more lines): I want to be able to find the mean age of each region, so the mean age for region SSC20790 and so on. I believe I can use the <...
31 views

### CP plot in decision tree showing upward trend only

In cp plot for decision tree, we expect the error to drop down with size of the tree (or form an elbow). This helps to select right cp value. But in my graph the relative error is continuously ...
50 views

### Decision Tree on Unbalanced Data

While running decision tree, i have unbalanced data. The data balance is 93%(Class 0) to 7% (Class 1). Now when i am plotting decision tree to understand the factors contributing to class 1 then in ...
34 views

### How to do Multivariate Adaptive Regression Splines feature selection in python? Specifically, I need the python equivalent of the earth function in R

This is the code in R: marsModel <- earth(eval(parse(text=paste(ResponseVariable,"~."))), data = data) #build model ev <- evimp (marsModel) Response ...
48 views

### How can I improve the accuracy of my model? (Cab Cancellation Prediction)

I am trying to predict based on several parameters like trip type, car type, source of booking, start time, lead time (start- book) and a few other params whether or not a customer will cancel. From ...
333 views

### Can I use LSTM models to evaluate multiple, independent time series?

Let's say that I would like to predict the temperature tomorrow. I could use the approach whereby I train a model based on a time-series dataset collected from a single location (for example, see this ...
21 views

### Can sampling like SMOTE/UP/DOWN applied on Validation set?

I am trying to predict classification problem. For that I have used Ranger, Xgboost and naive bayes. My Response class is imbalance . 92:8 ratio. My positive Response is only 8% of whole data. ...
57 views

### Grouping by 2 Columns in R to Sum, Count, Percentage, Weighted mean, mode [closed]

I am trying to use dplyr or data.table to calculate sums, percentages, counts, and weighted means for various sub groups. Each Name can have subgroups High Medium and low, and potentially others, and ...
422 views

### Ways to simulate weather data over several periods (Python or R)?

I have a time series dataset that has several variables for a state/province for fixed periods of time. That is for state A, there are samples from April 2017 to July 2019. Of course, I thought adding ...
24 views

### Using Boruta for determining the magnitude of importance of R, F and M [closed]

I am a novice to R and sorry if this question is missing the mark. I am working on a dataset with high seasonality and trying to assign weights to recency, frequency, and monetary value. For this, I ...
43 views

### NLP problem : Choosing the optimal parser for extracting quantitative values from text

I have a clinical NLP problem for which I would need some help to establish a proper framework. I am trying to extract different elements from echocardiography reports. Those elements are both ...
28 views

### Correlation, Feature Importance in R

If I have 150 features, with the output feature being nominal(multi-class), how can I verify which features play a key role in determining the class?
41 views

### Problem in performing LOOCV

I am trying to run LOOCV on my regression model. I tried to run it in r and encountered the following warning message: ...
9k views

### How to plot multiple columns with ggplot in R?

I do have a data frame with different categorical and numerical columns with the following schema: Id | num_col_1 | num_col_2 | num_col_3 | cat_col_1 | cat_col_2 ...
26 views

### Fitting glm without explicit declaration of each covariate

When I fit a linear model with many predictor variables, I can avoid writing all of them by using . as follows: ...
10 views

### Which PC hardware would you recommend to invest in for movement ecology studies in R (x,y,t data analysis)? [closed]

I mean all possible work with tagging data: GIS, tagging data pre-processing, visualisation, different types of modelling, simulations and modern analysis. I think it will be about 40 tagged animals ...
60 views

### Time Series Forecasting

I work in the Oil & Gas industry. I have been trying to build a ts forecasting model with covariates, and the model R code is as follows: ...
40 views

### NA in LR model summary(R)

So, i was trying to improve mr LR model performing multiple linear regression on a dataset. I had a categorical variable region Region(variable): Midwest Northeast South West I made dummy ...
23 views

### How to find transictions and group variables

Having a dataset like this: ...
17 views

### Replace values before and after a certain value [closed]

I have a variable like this: V1: 0 0 0 0 0 1 0 0 0 0 0 2 0 0 0 0 0 I want to change the 0 before the 1 to 1, and the 0 after the 2 to 2. It is supposed to look like this: V1: 1 1 1 1 1 1 1 0 0 0 0 ...
51 views

### R: Producing multiple plots (ggplot, geom_point) from a single CSV with multiple subcategories

I have a collection of bacteria data from approximately 140 monitoring locations in California. I would like to produce a scatterplot for each monitoring location with the Sampling Date on the Y-axis ...
25 views

### Identify members who are likely to switch where they receive drug administration

I have access to medical claim data from a large health insurance company. As some of you may know there is a large delta between the price of drug X depending on where it is administered. My ...
47 views

### Select the right distribution

I have a dataset like: ...
225 views

### Which feature selection technique to pickup(Boruta vs RFE vs step selection)

I have data with 103 columns. I would like to understand which algorithm is best for feature selection and what may be the logic to call any feature as best. ...
43 views

### Machine learning dataframe dimension concept vs NumPy dimension

From Machine Learning for Absolute Beginners: A Plain English Introduction: Contained in each column is a feature. A feature is also known as variable, a dimension or an attribute - but they all ...
42 views

### Finding optimal threshold in extreme value theory - Peak Over Threshold-method (POT)

I am using r and doing a project with extreme values. Now I need to find optimal threshold based on charts outputs but I can't find any information how to interprete them. I am using ...
79 views

### R: Error when using Aggregate function to compile monthly means into yearly means

Disclaimer: I'm extremely new to R and have been getting by with using google as my professor. I have a somewhat large collection of monthly values over a period of several years from several ...
20 views

### Testing for gender composition between groups

I did kmeans with k=4 and I would like to find out if there are any differences in the composition of gender between the 4 clusters. Do I use Fisher's Exact Test of Independence? Is there any ...
18 views

### Four parameter self-starting function based on SSfpl

I am currently working with a self-starting function for four parameters which I based on SSfpl but with a different formula. This is the formula for my self-starting function: ...
31 views

### R, optimal return level from output chart, gpd.fitrange (ismev)

For purpose of project I must find optimal return level using gpd.fitrange from ismev library. Can anyone tell me how to interprete the chart it outputs? What is the optimal return level here?
295 views

### How do tech-companies employ Random Forest on large data sets?

The algorithm takes quite a long time to train on large data sets with a moderate number of parameters: https://stats.stackexchange.com/questions/37370/random-forest-computing-time-in-r https://...
43 views

### How to convert this forumal to a proper code?

I have the following formula [1] that I attempted to transform in to a function via R. However, my initial outputs are disconcerting. Before I go through many blocks (images), I am hoping to get ...
21 views

### How can I combine two datasets and assign factors to each?

I have a very basic question (just starting with R). I have two datasets (xlsx files) with one variable (x) and 11 observations. I need to combine these two tables to one table with the variable x (...
310 views

### can't install gRain package

I am new to R and trying to install the gRain package. However, I am getting the error: dependency āgRbaseā is not available Then, when trying to install gRbase ...