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
8 views

How to use a varImp function to select features from training set?

Till now I have used a following flow for training a random forest model. ...
0
votes
2answers
8 views

Prediction of n class variables

I have a historical data that has discrete variables. Let say I have data points with class labels 1, 2,3,4,5. For a given classification problem, I can use the training data and then get the trained ...
0
votes
0answers
11 views

P-value F statistic test [duplicate]

I want to calculate the p-value from a two-sided test using f distribution function in R, but I don't know how t do it. I've tried with some tutorials, but it doesn't work.
0
votes
1answer
26 views

Two-tailed p-value in F test

I want to calculate the p-value from a two-sided test for an F distribution. Please explain in detail how this works. (If possible, I'd also like to see how to implement it in R.)
0
votes
0answers
17 views

Using SMOTE for building CART models

Suppose I want to build an interpretable model and the response variable is 0/1. However, there are 99% 1's and 1% 0's. The date looks like this: ...
0
votes
0answers
8 views

test fitting different sinusoidal models

I have some time series data and would like to see whether it can be better described by fitting (1) one sinusoidal function or (2) two sinusoidal functions combined, both with different frequencies. ...
0
votes
0answers
16 views

Removing outliers in R plot function [migrated]

I'm trying to do a scatterplot in R and would love to remove an outlier I've already identified. My plot function: ...
0
votes
0answers
15 views

AIC/BIC score on summary object in R

I have a fixed effects model in R where I need to use Newey-West standard errors and use the AIC score to compare models. ...
0
votes
2answers
46 views

Using Uniform Distribution to Generate Correlated Random Samples in R

[On recent questions I was looking into generating random vectors in R, and I wanted to share that "research" as an independent Q&A on a specific point.] Generating random data with correlation ...
3
votes
2answers
47 views

ANCOVA intercepts - does R center data?

I have 2 fixed effects and 2 continuous predictors. Nothing interacts so I believe I want a model of the form: $$Y_{ij} = \mu + \tau_i + \beta_j + \gamma_1(X_{1ij}-\bar{X_1}) + ...
0
votes
0answers
12 views

I keep getting the error “iteration limit reached” when using LME

I'm trying to model the effect of island size and island isolation on species richness using a LME. However I'm getting this error message "iteration limit reached". ...
0
votes
0answers
7 views

How to interpret the results of geweke.diag() function present in Coda package of R?

I am using geweke.diag() to check the convergence of an MCMC chain, I am using following R-Code for the purpose ...
-2
votes
0answers
16 views

problems in round [on hold]

I have noted that the function of round in R is not consistent. for example: round(12.5) [1] 12 ( Round down) round(13.5) [1] 14 (Round up) How I can always get 0.5 down or up?
0
votes
0answers
7 views

predictions with caret and logistic with restricted cubic splines

I am fitting a logistic regression using RMS's R package restricted cubic splines and within the caret package infrastructure. I fit the model well, but when I ask the model to predict new samples it ...
0
votes
0answers
8 views

Bnlearn: Predicting multiple node values

I'm using an r-package "bnlearn" to work with a bayes net I have constructed: ...
1
vote
0answers
12 views

Adding point and lines to 3D scatter plot in R [migrated]

I want to visualize concentration ellipsoids in 3d scatter plot in respect of principal components (principal components as axes of these ellipsoids). I used function scatter3d with option ellipsoid = ...
3
votes
1answer
17 views

How to tell whether a predictor in a survival model useful?

For the question below (e), I think I need to compare the median survival times for two groups so that I can decide whether AG is a useful predictor. To do so, I wrote the code below, but do not know ...
0
votes
0answers
16 views

Regression model and Social Network Analysis

I want to study the internal Italian migration using the network analysis. My nodes are the Italian cities, the edges are people who move from a city to another. I built my edge list in SPSS. I have ...
1
vote
2answers
64 views

Interpreting results of KPSS test in R

I've been trying to create an ARIMA model however, I'm not sure how to determine if the data is stationary or not. I preformed a KPSS test in R using kpss.test from ...
0
votes
0answers
13 views

R anova (aov) repeated measures gives same effect in different error sources

I have a repeated measures design, where A and B are within-subjects factors. I tried m1 <- aov(y ~ A * B + Error(subject/(A*B))) summary(m1) But the results ...
1
vote
1answer
15 views

Bootstrapped Regression Residuals

This relates to using bootstrapping of residuals in regression. I do not understand the point of this procedure, i.e. bootstrapping the errors and then adding the residual back to the predicted ...
0
votes
0answers
12 views

R packages install from local drive [on hold]

I don't have access to internet. Hence, i downloaded sqldf package from other system and then transfer it to this system. The sqldf_0.4-10.tar file is saved in "C:\Users\Riya\Documents\R" and also ...
0
votes
0answers
5 views

How do I interpret lagsarlm output from R's spdep?

I've run lagsarlm on my dataset, using a mixed model and using a row-standardized adjacency matrix. I have results that I think are good, but would am not sure how ...
2
votes
1answer
34 views

Interpreting the spread-level plot from R

I created a spreadlevel plot on my simple linear regression model in R. Here is my code, spreadLevelPlot(ols_reg) where ...
0
votes
0answers
26 views

How to deal with highly unbalanced data

I want to build a CART on data where the response variable is a binary variable, but it is highly imbalanced(i.e. 100,000 0's and 4000 1's). Are there any R packages that allow you to build CART ...
-1
votes
1answer
20 views

rbinom() produces NA values. What's wrong?

I have to generate RV from a binomial distribution with R . I have a vector for $n$ and a vector for $p$ and for each component I have to generate a random variable. My idea was the following for ...
0
votes
0answers
19 views

Interpretting arima xreg output in R

I have an interrupted time series consisting of 200 observations that I've cleaved into two subseries: a sub-series of 150 pre-interrupted observations, and a sub-series of 50 post-interrupted ...
1
vote
1answer
9 views

How to interpret concretely the misclassification error?

I'm reading about Cart classification with rpart on R, and after all we should compute the misclassification error, given that y is the column that stocks classes, and x is the variable columns and ...
0
votes
0answers
23 views

R - Intepretation of rpois(1,lambda=c(1,2,3,4)) [on hold]

From what distribution does R generate a random observation from if I were to run the code rpois(1,lambda=c(1,2,3,4))? I think I understand what ...
3
votes
0answers
23 views

How to check variables changeable dependency in R?

I would be very thankful if somebody could help me and explain the answer in simple terms. I have y, x, z variables. They are countinuous, no missing values. y is dependent variable, x and z ...
1
vote
0answers
15 views

entropy-calculation in R [on hold]

Is there anyone to have used the package "entropy" ? How can I create a vector of counts if my sample is large (2000 points)? I tried creating a vector of counts using table(), is there a more ...
2
votes
0answers
29 views

Automatic keyword extraction: using cosine similarities as features

I've got a document-term matrix M, and now I would like to extract keywords for each documents with a supervised learning method (SVM, Naive Bayes, ...). In this model, I already use Tf-idf, Pos tag, ...
2
votes
1answer
47 views

Residuals Interpretation:Time Series Data

I am trying to use multiple regression for a time series dataset. I have values corresponding to a variable measured by 24 hrs for 4 months. Since there was a pattern which repeated every 24 hours I ...
3
votes
3answers
42 views

Generating and Working with Random Vectors in R

I've been trying to understand random vectors and generate them in R to reproduce properties. Recently, I asked a similar question, and it was rightfully placed on-hold for being too general. Thanks ...
1
vote
1answer
45 views

Random forest and model predictions

I have a working random forest model (classification tree) in R that I made with a training dataset. I used the predict function with a verification dataset: ...
3
votes
1answer
44 views

regression with circular response variable

I am analyzing some data where the variables of interests are circular (angles). I use R and the circular package. In my dataset, every observation consists in a ...
0
votes
0answers
15 views

RMSE and Decision Trees

I'm running a series of regressions using decision trees and am getting good results, but I've got a question. In the pacakge rpart, you can run cpplot to get a graphical representation of where to ...
0
votes
0answers
18 views

Meaning of the prior and loss parameters in rpart in R

Could someone please explain to me what specifying priors and/or loss parameters in R's rpart actually do? I found R's documentation completely unhelpful. For example, let's suppose I have a highly ...
0
votes
0answers
10 views

Regression case in R (additive model)

I have a response variable y which takes values in [-1,1], and I have some explanatory dummy variables (only take values 0 or 1) x1, x2, x3. How can I create an additive regression model (with a ...
0
votes
1answer
55 views

How to test two lines from the same model are parallel

If I have two sets of data each with 5 entries for X&Y, I built a model to incorporate this using a dummy/indicator variable for when X is in Set B, so obviously I get two parallel lines; ...
0
votes
0answers
19 views

Error running a ridge regression in glmnet [on hold]

I'm trying to determine via cross-validation what lambda to use for a Ridge regression to create a model predicting crime per capita using the Boston data. Here's ...
0
votes
0answers
29 views

What quantile method is ideal for a moderate sample size of data?

I have several samples ranging $n =$ 15 to 40 coming from a population with a presumed non-normal distribution. I'm trying to calculate the 25th and 75th percentile but find differences between the ...
0
votes
0answers
13 views

Error in Gradient Descent Calculation [on hold]

I tried to write a function to calculate gradient descent for a linear regression model. However the answers I was getting does not match the answers I get using the normal equation method. My ...
0
votes
0answers
13 views

negative values for frequencies, in package entropy in R [migrated]

Using the package "entropy" in R, I have a vector y with decimal points and positive and negative values. Calculating the frequencies, I get positive and negative values corresponding to the ...
0
votes
0answers
5 views

R: lrtest for systemfit on specific equations [on hold]

In R I did two SUR regressions with systemfit, like: ...
2
votes
0answers
27 views

Are SAS certifications worth it? [on hold]

I am currently getting my masters in statistics. I was wondering if certificates such as the SAS certification program are worth pursuing. I was also wondering if there are any similar programs for ...
0
votes
0answers
20 views

Checking for significant differences in two independent correlations

I have measurements for DNA methylation and gene expression from different cancers. I want to carry out hypothesis testing to see if the correlations between methylation and gene expression in one ...
2
votes
1answer
28 views

So many significant explanatory variables and so small auc

Have you ever seen a model with almost every significant variable and such small auc (area under the ROC curve) ? What might be the cause of it? When I saw summary of a model I thought this model will ...
2
votes
2answers
16 views

How much missing data is too much? Multiple Imputation (MICE) & R

Currently I am working on a large data set with well over 200 variables (238 to be exact) and 290 observations for each variable (in theory). This data set is missing quite a lot of values, with ...
1
vote
1answer
48 views

Censored regression in R

I have a Tobit model of the form: \begin{align} Y^*_i &= X_i\beta + \epsilon_i \\ Y_i &= \max(Y^*_i,0). \end{align} The regressors are one continuous variable and 30 factors (modelling ...