Questions tagged [r]

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

381 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
1
vote
0answers
1k views

Markov chain modelling?

I am working on a personal loan dataset. For each loan, we recorded its credit status monthly after it was drawn by the borrower. Let's say there were 6 status coded by A-F. My project is to use ...
1
vote
0answers
206 views

Understand output of pwr.t2n.test in R

New to stats and R and was wondering if anyone can help me understand the output of the following code ...
1
vote
0answers
1k views

Package RTextTools loaded but facing Error: could not find function “create_matrix”

install.packages('RTextTools') library(RTextTools) data("NYTimes", package='RTextTools') head(NYTimes) timesMat <- create_matrix(NYTimes$Title) The package ...
1
vote
0answers
122 views

How to use rmagic in Azure Notebooks?

I am trying to get some data out of R snippet to Azure Python 3 Jupyter notebook (hosting is available for free at http://notebooks.azure.com). I tried the following in Python 3 notebook: ...
1
vote
0answers
191 views

Binning of Continous Predictor and Predicted Variables

My problem has three categorical variables C1,C2, C3 and one continous variable ...
1
vote
0answers
30 views

Nearest Neighbours variant approach

Hi i'd like to know a bit more about kNN-like approach implementations for classification problems, and specifically classification problems where we want to have a probability distribution as an ...
1
vote
0answers
147 views

Phrase frequency in R

I have unstructured data (15MB text files). I could extract most frequent terms and now trying to get most frequently used phrases. So instead of "credit" and "card" as separate terms I am trying to ...
1
vote
0answers
68 views

R: tobit with a varying censoring level (cnreg equivalent)

I have county-level data from each of the 50 states, and each state suppresses data differently. I've been looking everywhere to find a way to do a tobit-type regression in R that can account for the ...
1
vote
0answers
23 views

Generating a set of Rules that defines a Group of users ( Multivariate Analysis )

I am working on a Multivariate Analysis on my dataset, I have a large dataset of 50k users let's call it (Loyal Users) with various numerical attributes +13 tracking the user's activity and events ...
1
vote
0answers
271 views

Unbalanced data fit in gbm

I'm trying to build a model using GBM in r in order to get probability of two classes ( 'yes','no'). My data are unbalanced, and because of this I trained my model using a balanced data(undersampling ...
1
vote
0answers
530 views

Prediction in the training sample with randomforest in r

I'm using a Random Forest algorithm in order to construct a classification model, and I HAVE to check the accuracy of my rf model in the training sample, but as you can see in this answers : https://...
1
vote
0answers
518 views

Score probability groups with Random Forest in R

I would like to use RF in order to get a score probability of a binary outcome, in order to know groups with higher probability of buy something. Like this: ...
1
vote
0answers
483 views

How to replace the missing values in Age column from Titanic/kaggle project

The code below doesn't give any errors but it doesn't iterate after the first observation, so it's useless. I tried using sapply without any improvement and I don't know if it's a smart approach to ...
1
vote
0answers
77 views

Consolidating values for predictive modelling through Random Forest

I am working on developing a predictive model using Random Forest. There are a lot of users that log in to the site but only a fraction of them actually monetize on that day. I am trying to predict ...
1
vote
0answers
170 views

How to build a unique decision tree for each subset of data based on a grouping variable?

Given: a data frame of 2.5 million records and 25 columns, which contains 1 grouping column with a variable number of groups (e.g. 2.5M records / 10 groups today; 2.5M records / 50 groups tomorrow). ...
1
vote
0answers
919 views

Entropy calculation for MNIST dataset to form classification decision tree

I am trying to get classification tree in R. I am using MNIST (handwritten digit dataset) to train my decision tree. The dataset has 28*28 pixel box. Pixels are organized in row-wise. Pixel values are ...
1
vote
0answers
153 views

Problem while reusing model for new observations

I want to build a model using R, save it and reloading it when required. I am able to save the model and reload it without any problem, however when i use the model along with predict statement, I am ...
1
vote
0answers
388 views

Errror in confusionMatrix in R

While i am using the confusionMatrix in R, I am getting the following error: Error in binom.test(sum(diag(x)), sum(x)) : 'n' ...
1
vote
0answers
35 views

How to extract the values used in columns by a Classification model in R?

I want to find the variables (and its values) used to build a classification model? I came to know that the following code does the same get_all_vars(model_built, dataset_used_for_building_a_model) ...
1
vote
0answers
588 views

R lm(log(y)~x,data) models and predict, need to remember the exp. R2 differences

I noticed a difference between R and Excel when it comes to trend lines. Basically I am automating a simple process that someone does. He/she takes web traffic and finds the best trend line by ...
1
vote
0answers
175 views

Huge discrepancies in Logistic Regression and SVM using HOG features to identify an Object

I am doing some research on Logistic regression and SVM using different parameters using HOG features. I am facing a bit of problem while understanding each classifier with combination of different ...
1
vote
0answers
746 views

R-Cassandra connection with RJDBC

I am trying to connect with cassandra in R using RJDBC. When I execute casscon <- dbConnect(cassdrv, "jdbc:cassandra://ipaddrs:9160/demodb") I am getting <...
1
vote
2answers
360 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 ...
1
vote
1answer
206 views

Underlying model for prediction using different prediction variables

I have time-series energy consumption data for a duration of one-month. The frequency of data is half-hourly. The features of dataset are temperature - temperature value at particular time instant ...
1
vote
1answer
28 views

R problem with fraction numerals

Why do I have a non-zero result in the following calculation: 0.11-0.1-0.01 [1] -5.20417e-18 Seems to be an easy and akward question, but I will be very greatful for any help!)
0
votes
0answers
16 views

K-means clustering for east west airline marketing data. Confused in choosing the optimal clusters

Ques: The file EastWestAirlines contains information on passengers who belong to an airline’s frequent flier program. For each passenger the data include information on their mileage history and on ...
0
votes
0answers
11 views

How can the forecast accuracy of three models for a categorical time series be compared?

This is a general question. Can anybody please point me in the direction of how I can compare the forecasts of a 3 level categorical time series by three competing models? I would like to compare the ...
0
votes
0answers
13 views

Error in predictions using glmnet() function in R

I've got a problem with my code, whilst making predictions using glmnet() Here is my code plus an error which occurs: ...
0
votes
0answers
9 views

Endogenous and exogenous ordinal variables in R studio Lavaan

I am new to using R studio, so apologies for the basic question. I have run a number of Confirmatory Factor Analyses using the Lavaan package. Each questionnaire item is on a 4 point Likert scale 0 = ...
0
votes
0answers
32 views

Odd results on bias-variance tradeoff assessment

I am running a bias-variance tradeoff assessment on ten regression models of increasing complexity (linear to x^10), but my results do not satisfy the MSE = Bias^2 + Variance + True Error relationship....
0
votes
0answers
9 views

R - using heatmaply for a 2d histogram / density

I have a rather long series of x, y coordinates representing a character in 2d space. Let's say that space is 200 x 400. I want to represent the amount of time the character is in each x, y coordinate ...
0
votes
0answers
12 views

python equivalent of doParallell in R

I have a code written in R which uses doParallel and makeCluster libraries. I try to convert that into Python and send it to a ...
0
votes
0answers
22 views

Trying to plot REC curve and calculate AUC in R but getting error

I am working on regression machine learning techniques and calculating AUC (plotting REC) by using below paper link: http://homepages.rpi.edu/~bennek/papers/rec.pdf My Code; REC <- function(y_val , ...
0
votes
0answers
14 views

Error when comparing testset with training set in ARIMA R

I am working on a monthly dataset (timeseries) using R. The dataset consists of 159 rows starts from Feb 1996 to March 2004. I set aside the last 12 months of data (Apr 2003- March 2004). Performed ...
0
votes
0answers
11 views

How to highlight text from text search output with includeHTML without using data frame or data table?

I created a working text search app but to ease user experience, I want to highlight text which is outputted in HTML file . Most of the information available is for converting into ...
0
votes
0answers
12 views

Adaptive Resampling in Caret with Pre-specified Validation Set

I was wondering if this is the correct way to get adaptive sampling in caret working with a pre-specified validation set using index. I can get this to work using the 'cv' method in caret like so <...
0
votes
0answers
12 views

Similarity matching between two distinct datasets (marketing case study)

I am working for a company that sells different products to customers. My objective is to find customers that are likely to purchase product X based on the profiles of customers that already purchased ...
0
votes
1answer
25 views

How to output my uploaded text in Shiny in R at the position of the screenshot?

I would like to position a long text on the right side of this Shiny app, as shown on the screenshot below. ...
0
votes
0answers
42 views

Do I need to use learning algorithms for this type of data?

I'm studying the behavior of machine failures in a production scenario. For this, I generated random data to form my imbalanced training set, consisting of categorical data, which indicate whether or ...
0
votes
1answer
20 views

Unsupervised Sentimental Analysis in R

How would you evaluate unsupervised sentimental analysis? I am reading on evaluating sentimental analysis and learning that much of the classification models that are being used, the data has target/...
0
votes
0answers
16 views

Using deep learning or statistical tools to complete physical equation

I need to predict a continuous variable Y in a regression setting. Theory in the field tells me it should follow an equation of the form: $$Y=g_0(X)-f_1(X)g_1(X)-f_2(X)g_2(X)$$ Where X is a vector of ...
0
votes
0answers
17 views

Supervised Text Classification

I need to create a summarized report showing how many containers are being imported by each company. This report needs to be generated on monthly basis. The company names are entered in a way that ...
0
votes
0answers
34 views

KNN regression in R

I'm studying a non-linear regression problem and I have read that K-nearest neighbors regression performs well in this case, is there an R implementation of this regression algorithm?
0
votes
2answers
39 views

Linear Regression Model

I'm taking a course on Supervised Learning in R: Regression. There is a section where I'm supposed to predict blood pressure given age and weight. This is was MY approach ...
0
votes
0answers
24 views

E-step for EM algorithm for document clustering

I have a code for the E-step in the EM algorithm for Document Clustering in the version of hard-EM algorithm. I'm trying to implement the E-step for soft-EM algorithm. Here is my code for Hard-EM: <...
0
votes
0answers
13 views

Importing A Neural Network From Mathematica For Use In R

I am experimenting with platform interoperability between Mathematica and R. My aim is to create an untrained Neural Network using Mathematica, export this network in MXNet format as a .json file, ...
0
votes
0answers
26 views

Including spatial spillover for categorical data in R

I did a regression analysis with categorical data with a glm model approach, which worked fine. I have longitude and latitude coordinates for each observation and I ...
0
votes
1answer
18 views

Running a query in R after establishing dbconnect

I do not seem to figure out what is wrong it the following statment. The connection to the DWH is establishe but the query statement in R seems not to work, with the following error : ...
0
votes
0answers
15 views

Same values for PCA Loadings results

I've recently performed a Principle component analysis for my masters thesis where I have 25 network datasets, formatted into graphs and applied 5 measurements to each graph. The measurements were ...
0
votes
1answer
35 views

R: Rates of change from an initial value

I have a collection of csvs and must produce yearly rates of change per group within each csv, as well as a rate of change compared to the initial value. I am using the function below to calculate ...

1
4
5
6 7 8