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
0answers
5 views

How to speed up propensity matching (matchit) in R?

My dataset has 7 columns(patient level data columns being age,gender etc and a target flag). My set has around 12 Million rows around 16K targets out of the same. I'm trying to match similar patients ...
0
votes
1answer
11 views

How to interpret Variance Inflation Factor (VIF) results?

From various books and blog posts, I understood that the Variance Inflation Factor (VIF) is used to calculate collinearity. They say that VIF till 10 is good. But I have a question. As we can see in ...
1
vote
1answer
141 views

Can you reuse observations from your train data in your final test data?

For an employee population, I am trying to determine who among the employees are likely to get injured in the future based on 2 years worth of data. Unlike in most machine learning problems where you ...
0
votes
2answers
15 views

Logistic regression threshold value

How can i set the threshold value for the target variable. For example if a target variable is chance_of_admit and it has values from 0 to 1, how can I pick a value and so that I can convert it to 0's ...
0
votes
2answers
27 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
995 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 ...
4
votes
2answers
3k views

Additive vs Multiplicative model in Time Series Data

The above time series plot is a daily closing stock index of a company. I want to know which model between additive and multiplicative best suits the above data. I know what the two models are, but i ...
0
votes
0answers
29 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
22 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
10 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
42 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
27 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
50 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 ...
0
votes
1answer
19 views

Topic Modelling by Category in R [closed]

I wanted to see if there's a way we can get the topics by topic modelling using LDA by category instead of whole dataset. My data looks like this. ...
2
votes
2answers
438 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
431 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
95 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
22 views

How to get a output of a hidden layer of a single-layer LSTM

How can get the hidden layer outputs in a simple one-layer lstm? ...
1
vote
1answer
92 views

Column header in XTS and Data frame in R

I used quandl function extract stock data with object type as xts. ...
0
votes
1answer
25 views

Fill the missing values (NA) in various columns (independently of each other) using imputeTS package (in particular, na_kalman function)

A friend of mine has recently started working on R-studio and is interested in filling the NA values in different columns using the above-mentioned function. Also, since he intends to run a time ...
0
votes
0answers
6 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
72 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
261 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
21 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
85 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 ...
0
votes
3answers
49 views

Why does changing the cluster number change the plot in Kmeans?

This might be a dumb questions but I can't find the answer to it. I don't have the perfect mathematical understanding of kmeans, so apologies if it is. I'm just wondering why I see a different plot ...
2
votes
3answers
48 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
67 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
66 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
1answer
22 views
0
votes
0answers
69 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
947 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
0answers
12 views

Multivariate survival analysis on R?

I’m doing a project where I need to carry out a multivariate survival analysis in R. The usual method is to use a Cox proportional hazards model but in this case, the proportional hazards assumption ...
0
votes
1answer
90 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
32 views

In a list, find the numbers where they are bigger than the next numbers

I'm using Rstudio. I have a list like below, I want to find all the numbers that are bigger than the next numbers (i.e. numbers on their right hand, I make them bold). 7 7 9 9 9 10 10 1 51 51 53 ...
1
vote
2answers
136 views

Xgboost in R: Dealing with extreme class imbalance

My data has an extreme class imbalance - 99.7% is 0's and 0.2% is 1's and almost all the predictor variables (6 out of 7) are categorical. I trained an xgboost classifier after performing an ...
0
votes
1answer
41 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
56 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 ...
0
votes
1answer
22 views

Customer Segmentation: Should I use a variable, representing a product, that is unpopular in the dataset for K-Means Clustering?

I am working with a data set that, besides customer age and income, tells the balance a customer has in different type of bank accounts: Checking, Shares, Investment, Savings, Deposit, Mortgage, Loan, ...
3
votes
1answer
781 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
17 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
32 views

How do you Show a Difference between Two Groups (Clustering)

I am approaching a data problem. My data set consists of observations of (X,Y) coordinates indicating a position on some grid. There are two groups based on a variable Z. Group A is all the points ...
1
vote
1answer
45 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
0answers
17 views

Reverse of Yeo Johnson variable transformation done by preprocess function in caret package to get original Target and predicted values

I have done a Yeo Johnson transformation by using preprocess from caret package. I have predicted the Target Variable using linear regression. Now I want to reverse the transformation for both the ...