Questions tagged [r]

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

Filter by
Sorted by
Tagged with
0
votes
2answers
29 views

Different significant variables but same Adjusted R-squared value

I performed a multiple linear regression on 64 variables with 3 different models: Performed Multiple Linear Regression on all 64 variables Perform Feature Selection with Random Forest and then ...
0
votes
3answers
1k views

Mutate with custom function in R does not work

I have a data frame, containing a column called: "Frequency". Frequency has values like "Year", "Week", "Month" etc. Now I want to create a new column based on the Frequency column where Year's new ...
0
votes
0answers
50 views

How to improve accuracy of Decision tree in R studio

I am currently conducting a study on the predictive qualities of odds (Regarding Football/Soccer). I have odds from multiple bookies on each of the seasons and leagues within the study ( as below ). ...
1
vote
2answers
26 views

How to make tool that's robust to user-generated typos?

Background: A client is generating datasets (excel files). They asked I make an app to analyze the datasets, e.g. summary tables and figures. I'm doing this in R shiny. Problem: There are many typos ...
0
votes
0answers
12 views

How does setting preProcess argument in train function in Caret work?

I am trying to predict the times table training a neural network. However, I couldn't really get how preProcess argument works in ...
2
votes
1answer
47 views

Evaluate clustering by using decision tree unsupervised learning

I am trying to evaluate some clustering results that a company did for some data but they used an evaluation method for clustering that i have never seen before. So i would like to ask your opinion ...
0
votes
1answer
21 views

Sample Space of Longest Run

I am trying to find a way to calculate all possible combinations of a sequence that have a certain length of long run. When answering questions regarding sequences of heads and tails, sometimes ...
0
votes
1answer
29 views

overfitting of regression tree from the beginning

I am trying to build a regression tree to model insurance claim frequencies. I have 36000 observations and 9 covariates. My model overfits right from the beginning!, ie as the cost complexity goes ...
0
votes
1answer
59 views

Random Forest Overfitting, issues with mtry=1?

I am constructing what is known as an 'Expected Goals' model for football. This metric measures shot quality and a probability is assigned to a shot to achieve this, i.e. the chance a shot will be ...
2
votes
2answers
503 views

How to define a custom metric function in R for Keras?

I just started using keras and would like to use unweighted kappa as a metric when compiling my model. Following the instructions from here, I tried to define my custom metric as follows: ...
0
votes
2answers
454 views

Assessing Group Similarities and Dissimilarities Post PCA

The goal is to assess similarity and dissimilarity between 6 known groups. The original data began with the 6 known groups and 2,700+ variables all on a scale of 0 to 100. I have performed PCA to ...
4
votes
2answers
120 views
4
votes
3answers
1k views

ICD-10 codes in Machine Learning

Can anyone provide specific techniques with using ICD-10 codes in Machine Learning? I have usually used a simply approach of creating multiple binary column representing ICD-10 codes… which can get ...
0
votes
1answer
24 views
1
vote
1answer
120 views

Column header in XTS and Data frame in R

I used quandl function extract stock data with object type as xts. ...
0
votes
0answers
8 views

`fourfoldplot` not displaying size and colors correctly with numbers in column labels

If I use a sample table, like so: ctable <- as.table(matrix(c(42, 6, 8, 28), nrow = 2, byrow = TRUE)) and plot with ...
0
votes
2answers
75 views

Help on Looping in R

I am trying to build a for loop in R. but facing the error as the loop is not creating the exact variable and may be double counting. What i trying to do is The code has to go through every row and ...
0
votes
3answers
303 views

Drop NA values in an imported xlxs document with R

I have the attached document. I've imported an xlxs document into R. I would like to get rid of all rows containing NA. I've tried the following but it isn't working. ...
1
vote
0answers
22 views

Predict with some probability the day of the month paycheck received through daily transactions

I am using R to do machine learning. I have daily shopping expenditure data of individuals over a couple of months and my goal is to be able to identify through their shopping pattern the day of the ...
1
vote
2answers
3k views

R - Error in KNN - Test and training differ

I am trying to classify set of text files whether it belong to category A or category B using KNN algorithm Here is the error that i get ...
1
vote
3answers
247 views

Correlation Matrix for non-numeric features

Currently, I have dataset with numeric as well non-numeric attributes. I am trying to remove the redundant features in the dataset using R Programming Languages. Note: Non-numeric attributes cannot ...
1
vote
2answers
53 views

Turning R scripts into a “data science tool”

I have R scripts that process a client's datasets (make figures, summary tables, etc). I'd like to package these scripts into a standalone program, aka data science tool, that I can give to the client ...
2
votes
3answers
53 views

Big difference in randomTree accuracy with train and test sets

I've created a model using randomForest for the following dataset: https://archive.ics.uci.edu/ml/datasets/Contraceptive+Method+Choice The thing i'm questioning is that the results of the model when ...
3
votes
2answers
74 views

Am I overfitting my random forest model (more information in description)?

First off, sorry if this a novice question! Relatively new to all this stuff. Posted this in Stack Overflow and someone sent me here! Hope it's the right place. Anyway, I'm working with 22 datasets ...
0
votes
0answers
109 views

Error using msmFit in R

I am trying to analyze a time series data using the MS model with R. I wrote the following codes and then got an error at the last line: ...
0
votes
0answers
109 views

Python Keras model performs much worse than R Keras model

I got this R Keras model from GitHub that performs really well. GitHub repo ...
5
votes
0answers
963 views

AdaBoost implementation and tuning for high dimensional feature space in R

I am trying to implement the AdaBoost.M1 algorithm (trees as base-learners) to a data set with a large feature space (~ 20.000 features) and ~ 100 samples in R. ...
0
votes
1answer
112 views

Adjusted R-squared is too high (=1) in Linear Model

I built a Linear model which has an adjusted r-squared value of 1. I understand that this is a near perfect number. Upon further investigation, I found that one of the 96 independent variables in the ...
0
votes
1answer
42 views

Remove specific words containing dots from a string

Hi I got words that contain one of the following tokens: CO. PRO. IST. How to clean my words from these tokens? Do you have any regex pattern? for example the words : ...
0
votes
1answer
64 views

R - How do I remove a varying number of digits from a date-vector

I want to remove a varying number of digits from a date vector. My date vectors looks like this: I want to convert this vector into a date vector, but first I have to get rid of the number in front ...
3
votes
1answer
805 views

Impulse Response Function - Negative Shocks on R

I have two questions on how to produce impulse responses using R (1) Impulse responses to a negative shock in the independent variable (money supply) (2) Impulse responses at 2 standard deviations ...
0
votes
1answer
20 views

Free API for historical weather US data?

I am trying to retrieve a free R-Python API that provides historical weather data in US. In fact wunderground API is no longer available. Any suggestion?
1
vote
1answer
56 views

how can I replicate working of Multi Label Binarizer from sklearn package in R?

I want to achieve same working of MultiLabelBinarizer from sklearn.preprocessing package in R. I have list of labels for each example (for Predicated and Actual) like below. ...
0
votes
2answers
412 views

How to split data frame into groups, combine rows

I have a large data set with 405 columns, many rows, and data from 15 sites. Each site has 27 columns, each one one quadrats data. Rows are species data. I would like to split the data into the 15 ...
0
votes
0answers
8 views

Decompose and stl decomposition functions problem when frequency is equal to 1

I am using the library fpp2 in R and using the wmurders time-series to forecast the murders of females in the US. We have a time-series from 1950 until 2004. I actually have a problem defining the ...
0
votes
0answers
13 views

Interpretation of hurdle model with negative binomial distribution

I envisage to employ a hurdle model in R, as for instance described here. Question: how I can derive marginal effects from the hurdle model? With linear ...
0
votes
1answer
30 views

How to distinguish between normal fluctuation and outliers in ARIMA model?

I have a dataset about sales per day of certain products at the ITEM/DAY/STORE level , I've plotted the series and visually examined it for any outliers, volatility, or irregularities. And this is ...
2
votes
2answers
851 views

Is there a Hyperopt equivalent for optimization in R?

I've used Hyperopt in Python, but I'm looking for a package with similar capabilities in R. Does a package like this exist?
0
votes
1answer
3k views

How to cluster multiple time-series from one data frame

I have a data.frame which has multiple time series in it, in the following manner: ...
1
vote
1answer
18 views

Is there a way to aggregate frequency distribution for many runs?

In the following plot I have frequency distribution for each of the fitness values that are shown in thte legend. Each run (x-axis) has a different frequency of each fitness value. The total runs is ...
0
votes
1answer
40 views

SQL and JSON database - R

I have a database (PostgresSQL) which looks like this: ""results"": {""WEBS"": {""WEBS_4"": [{""ip"": ""XXXXX"", ""value"": ""YYYY""}]}} I would ...
1
vote
1answer
30 views

xgboost in R have different results compared to boosted decision tree in Azure ML

I have a small data set (4000 records with 10 features) and I used XGBOOST in R as well as Boosted Decision Tree model in Azure ML studio. Unfortunately the results are different. I like to optimize ...
0
votes
0answers
111 views

Why does Caret featurePlot returns returns NULL?

I am trying to use featurePlot of caret in R. This is the code I am using: ...
0
votes
1answer
35 views

Grouping factors in more general ones

I have to work on this database on R. I have tried to make a tree model, but all the variables are factors with too many levels. I tried changing the column "operator" in three levels (keeping private,...
2
votes
1answer
1k views

Is there an R tutorial of using LSTM for multivariate time series forecasting?

There is a great blog post about how to use keras stateful LSTM in R to forecast sunspots. I applied it to financial ts data ...
1
vote
0answers
14 views

r - tbart package, allocations function - How can I force a solution without a list of sites?

I am attempting to solve a p-median problem for a given dataset. I can successfully produce a list of optimal candidate sites. However, I am interested in a secondary list of optimal candidate sites ...
0
votes
1answer
34 views

R packages: How to access csv files in data subfolder? [closed]

I have successfully written an R package and want to ship it with a specific csv file. I placed the file in the data and ...
0
votes
1answer
28 views

How do I compare data frames in R?

I have two data frames, dfA (t1) and dfB (t2), with subject IDs and associated variables. I want to compare the two data frames based on subject IDs and retain the subject IDs (and the associated ...