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

AUC of Survival ROC smaller than 0.5

If we obtain an AUC < 0.5 analysing a binary response variable (0/1) with a marker, this means the negative values of marker is associated to the value 1 of the response. We could use the trick to ...
2
votes
1answer
34 views

“One sided” classifier

Below was tried in R, but any general solution would be highly appreciated: I have 2 class samples (both classes are balanced). I want to create a classifier, where I only care about 1 class (So, if ...
0
votes
0answers
25 views

Simulation of logistic regression power analysis - output given

This question is in response to an answer given by @gung in regards to this question I am also wanting to use simulation to conduct a power analysis on a multiple logistic regression. To keep it ...
1
vote
1answer
41 views

How do I implement missing value patterns?

I have a training data set and I was able to find some interesting patterns in the missing values, and I used binary variables in order to represent the missingness. I am going to train a model, say a ...
0
votes
0answers
13 views

How to marginal correlation in R [closed]

I am trying to reproduce the results in the paper: Adaptive lasso for sparse high-dimensional regression models(2008) http://www3.stat.sinica.edu.tw/statistica/oldpdf/A18n420.pdf On page 1615 step ...
0
votes
0answers
9 views

mu.spline on grofit R package are too small

I'm trying to generate growth rates for 20 different strains of E. coli. I am utilizing the 'grofit' package from R and the program is coming up with nice curves and splines, however, the mu.spline ...
0
votes
0answers
39 views

What does the P value in restricted cubic spline plot mean? [duplicate]

What does the P value in the following example mean? ...
4
votes
2answers
67 views

How to simulate a random slope model

I would like do create a mixed linear model for an unbalanced dataset (different number of events per subject and a few missing values for some time points). I am using ...
0
votes
0answers
11 views

Quickest distance computation between two large vectors in R [migrated]

I wish to calculate the distance between each element in one vector and each element in another vector in the quickest possible way in R. A small example is: ...
-1
votes
0answers
16 views

Is it possible to to build Computer Assist Personal Interview (CAPI) using R Programming? [closed]

Most recently Computer Assist Personal Interview (CAPI) and CATI is a fast growing data collection method. Many company build their software for CAPI, CATI. As for example, IBM SPSS Data Collection ...
-1
votes
0answers
14 views

alpha levels and significance [closed]

How does the reporting of alpha levels and significance lend credibility to the research findings? How does this allow the researcher(s) to generalize to the larger population from their test sample?
0
votes
0answers
15 views

Tree not predicting all factors

I'm using the "tree" function to fit a model to predict a factor "Output" based on A, B, C, D and E ...
0
votes
1answer
25 views

Simulating a Brownian Excursion Process using Software

I would like to simulate a Brownian excursion process using a computer. I want to create sample paths of a Brownian excursion (a Brownian excursion is a Brownian bridge conditioned to be positive at ...
0
votes
1answer
24 views

In a random forest, is larger %IncMSE better or worse?

Once I have built a (regression) random forest model in R, the call rf$importance provides me with two measures for each predictor variable, ...
0
votes
2answers
44 views

R: Multinomial Logistic Regression for health data

I am doing some data analysis on a fairly large health data set of patients with diagnoses and the respective procedures received for each event. I was asked to run a multinomial logistic regression ...
1
vote
0answers
23 views

too many ties in knn? how to solve this problem

I use the knn model to train my data and then eliminate accuracy via cross-validation, but when i use the following code, I get the error: Error in knn3Train(train = c(1680, 300, 480, 240, ...
-1
votes
0answers
26 views

Automatic identification of numeric vs categorical variable

I am trying to build an automatic data preparation pipeline. One of the capability which I want to include is the ability to tag a variable as Numerical or categorical. Currently the idea I have is to ...
0
votes
0answers
6 views

Change SetClass in R (library fPortoflio)? [closed]

I am using the library fPortfolio e and I would like to change an SetClass. In particular this function portolioSpec() that as default is: ...
1
vote
2answers
59 views

Random Forest - Numeric and Dummy Variables together

I am trying to create a logistic regression model and a random forest model on the same data to predict probability of default. For the logistic regression model, I have created some dummy variables ...
0
votes
0answers
9 views

Examples of using the fa.poly function in R (psych package) [closed]

I'm looking to do an exploratory factor analysis on some survey data using R. The variables I'm interested in analysing are categorical (factors), so as far I have been able to figure out reading ...
1
vote
0answers
15 views

a crossover repeated measure feed trial using R

I attempt to analyse a crossover feed trial using R but I`m not good at statistical analysis. My data contains 10 subjects, equally divided into 2 groups named A and B. Each group were fed with diet A ...
0
votes
0answers
28 views

At what level are GAM p values significant?

I have constructed a Generalized Additive Model using the mgcv package in R. What I have in the output is the p value of the smoothing functions, as well as the influence of the factor and the ...
0
votes
3answers
47 views

Relationship between price and quantity in R

I tried to figure out how I can analyze this project. To find out how to analyze relationships between prices and quantities. I think with only two variables you can't build models. For example, one ...
0
votes
2answers
67 views

How to fit a glm with sum to zero constraints in R (no reference level)

Question has been rewritten I am trying to fit a glm to find out how the rate of events happens (counts/exposure) related to some covariates, with Poisson error. Counts is the number of events ...
0
votes
0answers
15 views

Difference between weights and prior in rpart and how to use them

I have a question about the "weights" and "prior" in R's rpart function. This question has been asked before here, but the answer doesn't quite make sense. Currently I have very unbalanced data ...
0
votes
1answer
17 views

Multilevel analysis or separate analysis for each level - group / individual analysis

I collected muscle activity levels from 4 different leg muscles on each lower limb over a 20 jump test in 2 groups of athletes. One group has ACL injury (n=11) and there is a control group (n=11). ...
1
vote
0answers
19 views

What is the R code for a 2 one-sided equivalence log-rank test? [closed]

I am trying to perform an equivalence test (alpha = 0.1, beta = 0.8, equivalence interval = 0.85-1.25) for two samples of survival data. Is there a code in R in the Survival package or any other ...
1
vote
2answers
75 views

What measure of training error to report for Random Forests?

I'm currently fitting random forests for a classification problem using the randomForest package in R, and am unsure about how to report training error for these ...
1
vote
0answers
21 views

Problem in passing parameter 'maximize´ through to xgbTree from caret train function [closed]

I am using train in caret package to train a xgbTree model. I want to use the early.stop.round parameter of ...
2
votes
0answers
11 views

Does R's NLS always fail if model parameters are not identifiable?

This question from several years back describes the "singular gradient matrix at initial parameter estimates" error. The answers say the reason for the error is that the parameters in the model are ...
0
votes
0answers
12 views

MARS Model Validation

Can anyone please explain how to validate MARS Model in R. I am running MARS Model with categorical DV and IDV's. And also please explain how to validate the outcome results. Thanks
0
votes
0answers
9 views

What does the argument “group” in aregImpute (Hmisc - R) do? [closed]

I've been trying to build a multiple imputation model for a Cox proportional hazards regression using the aregImpute command in R. However, one of the factors has less than 5 observations in one of ...
0
votes
0answers
12 views

is there any R package for calculating transition probabilities for multi order markov chain?

I need to estimate the transition probabilities of a user whose k recent selections were x1, . . . ,xk and will select the item x' next. I know to calculate first order transition probabilities but ...
1
vote
0answers
18 views

Reverse function to tolerance interval, using R

Given a data set and a min/max range, I want to know (with given alpha value) what portion of the population will be in it. This is the opposite of the tolerance interval, as I see it.
0
votes
1answer
33 views

Class weights in caret

I'm using the R package caret to generate classifiers using a variety of different models on an imbalanced dataset. To overcome the class imbalance problem, I am using the "weights" parameter in the ...
1
vote
1answer
58 views

Differences in nlme output when introducing interactions

I am searching for correlations between a dependent variable and a factor or a combination of factors in a repeated measure design. So I used lme() function in R. However, I am getting very different ...
1
vote
0answers
13 views

Interpolating population data

I'm currently doing an internship where I have to calculate incidence ratios for townships for a period of 11 years. I don't have access to the population data for all years and I would like to do ...
-1
votes
1answer
15 views

R - merge on rownames [closed]

I was wondering what the best way is to merge in the following case.The dataset state.x77 has the States as rownames (see example below). i am trying to merge this dataset with another dataframe that ...
0
votes
0answers
26 views

Representing experimental data by unconstrained ordination: PCA, PCoA, or NMDS?

I have a dataset composed by presence of different bacterial families in function at different pesticide treatment. I need to find a good representation of my data but I don't know which method ...
-2
votes
0answers
13 views

Summary of quantile regression without st. error, t value and p value [closed]

I need the p value of the third coefficient in quantile regression but R shows only lower b and upper b ...
3
votes
1answer
72 views

How to specify logistic regression as transformed linear regression?

I am trying to reproduce the following example of logistic regression with a transformed linear regression: ...
0
votes
0answers
28 views

Sample size for logistic regression with a random effect

I wish to dig out a sample size (or to do a power analysis for a given sample size) for a logistic regression model with a random effect. To simplify, let's say I have a binary dependent variable Y ...
1
vote
1answer
37 views

Estimating regression coefficients in the presence of stochastic trend

I have a very basic problem. My time series is modeled as: $$Y_t = a_t + \beta x_t + v_t$$ $$a(t) = a(t-1) + w_t $$ where $ w_t$ ~ $N(0,W) $ with known W, and $v$ is white noise. I don't know if ...
2
votes
1answer
98 views

What does the HAT matrix looks like when the residual sum of square equals zero?

What does the HAT matrix looks like when the residual sum of square equals zero? How do the predicted y and the measured y relate to each other in this case?
0
votes
1answer
68 views

I built a random forest model in r…now what? [closed]

I've built a random forest model in R. All looks great in terms of my accuracy and AUC on the test set. How can I take extract the model so I can apply it to data in my database? For linear ...
3
votes
1answer
83 views

Multiple ARIMA models fit data well. How to determine order? Correct approach?

I've got two time series (parameters of a model for males and females) and aim to identify an appropriate ARIMA model in order to make forecasts. My time series looks like: The plot and the ACF ...
0
votes
0answers
10 views

Canonical correlation analysis on R: repeated data

I'm new to this, so I am sorry if it a dumb question! I have one set of data with 88 variables (X) and another set of data with 3381 variables (Y), hence I will be using the regularised CCA (both ...
0
votes
0answers
19 views

Looking for a package to visually show this [closed]

I want to be able to visualize a very long string of say 1000 characters in one line. From there the user can horizontally scroll through that long string of 1000 characters or zoom in to only see the ...
1
vote
0answers
36 views

R optim function : can it be used as a Solver [migrated]

I saw another question here on this forum, and saw that the Optim function was used as a kind of Solver instead of as an optimizer. Here is the link: ...
0
votes
2answers
25 views

Strange result in Poisson regression - R

I have performed a Poisson Regression in R, but I got strange results that I cannot find an answer for. My data is like this: ...