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
3answers
30 views

ROC, variables, unbalanced data, where to start?

Can someone explain to me how you would know which variables to remove? And how do you know if something is accurate or not? Because when I plot an ROC curve the specificity/sensitivity curve, it ...
5
votes
1answer
140 views

Do logistic population growth models relate to binary logistic regressions?

I ask this because all resources regarding logistic regression in R involve binary outcomes, so they try to model questions like when will increase in temp cause a switch to fail (0, 1)—involving ...
1
vote
1answer
51 views

Using predict() in R to predict the y-value for multiple occurrences of the same x-value

If I have a linear model and want to use predict() to predict the mean and confidence interval of multiple ($m$) new observations of a given x-value ($x_h$), how do ...
0
votes
1answer
12 views

QQ Plot question related to trading

I'm kicking the tires of DSP and don't fully understand the tools. I built an algorithmic trading system and decided to do a Q-Q plot of the signal to noise ratio against the average return for each ...
2
votes
1answer
27 views

Calculating residual DTW distance for a subset of the alignment (Dynamic Time Warping)

My question is: "How do I find the cost for each step taken using the dtw R package?" My work is below, so if you see an easier solution please point it out! DTW is very effective at aligning my ...
0
votes
1answer
16 views

How do I interpret ANCOVA results?

I'm interested in proving that the recovery rate (slopes) of two species (MJB & NJB) are different.It's pretty obvious just looking at the regression that the slopes are different (-0.69 vs 1.62), ...
3
votes
1answer
99 views

projecting survival curves estimates into the future

Lets suppose I have a have a survival curve from 0 to 6000 days using Kaplan -Meier curves. How would I be able to project future survival rates from 6001 and forward ? Is there a function or ...
0
votes
0answers
15 views

For feature selection: VIF (variance inflation factor) and Correlation Feature Selection with kfold cross validation

Someone asked a question about automatic variable selection for modeling: Algorithms for automatic model selection The community raised concerns that using step() and other methods like that suffer ...
3
votes
1answer
36 views

how to interpret log transformed variables in survival analysis?

Suppose I have the following models: fit1 <- coxph(Surv(y,cov)~x,data=records) and ...
1
vote
1answer
26 views

glm.nb fails to converge when adding one zero

I have a problem where glm.nb (R version 3.1.0, MASS version 7.3.33) converges on some data, but adding only one 0 it does not converge any more. This is the data ...
0
votes
1answer
33 views

How to calculate predicted values using an lm.ridge object?

I've found this line of code to calculate predicted values from a ridge.lm model: ...
0
votes
0answers
9 views

Estimation of a Probit model via data augmentation using JAGS [migrated]

I'm trying to estimate a Probit model with data augmentation. This works without data augmentation, but the end goal is to estimate a multinomial Probit model, where data augmentation is helpful. ...
0
votes
0answers
17 views

Combination of two SVM Kernels

According to the book "Support Vector Machines" from Cristianini and Shawe-Taylor, it is feasible to make kernels from kernels. My question is now more in application of this methods with tools like ...
0
votes
0answers
12 views

Working with two scales at the same time

I have been working on an analysis of a quality of life scale for musculoskeletal disorder (WMSD) patients and I came across a doubt about how would be the best way of conducting a Rasch analysis on ...
0
votes
0answers
13 views

Clustered bootstrap for multilevel data with caret train in R

The clustered bootstrap would be appropriate for assessing predictive performance of a model with multilevel data where, for example, students are nested within schools such that there is a non-zero ...
2
votes
1answer
69 views

Meta-analysis in R with standard errors instead of standard deviations {metafor}

This is the formula I would need to use to perform a meta-analysis in R using the package metafor: ...
2
votes
0answers
36 views

R: Model selection with categorical variables using leaps and glmnet

I have a linear model containing a few continuous variables and four categorical variables, each represented by 12, 3, 4, and 5 dummy variables respectively. When using model selection criteria such ...
0
votes
0answers
20 views

Visualization Question [duplicate]

Simple question, has anybody ever seen a similar visualization to the one below? If so what is the name of such a graph and what software could be used to create it?
0
votes
0answers
20 views

In a EI RxC model, how can I incorporate additional external information?

I'm fitting an ecological inference RxC model, such as described by the Rosen et al. (2001) paper and implemented by the EI R package. I'm estimating voice transfer from the first round to the second ...
0
votes
0answers
14 views

How to plot multiple variables of a data.table in R? [migrated]

I have a time series that has a DateTime variable and 4 more variables, which are measured over time. I'm trying to create a function in R which gets the data set (as a data.table) and creates 4 ...
0
votes
0answers
22 views

Is conditional logistic regression appropriate for comparing costs between treatments?

I am looking at previous reports done by a previous staff member comparing 2 treatments - lets call them treatment A and B for epilepsy and the total costs for a matched population. For instance the ...
2
votes
1answer
33 views

Censored Binomial model - log likelihood

I have a dataset with multiple samples of batches of observations (e.g. one batch of 20 obs., one batch of 50 obs,, etc.). There is a probability that the batches have contaminated observations, with ...
0
votes
0answers
12 views

Is there a consensus method for defining outliers in a data set? [duplicate]

I am working on a large data matrix and I would like to know if there is a consensus method for defining outliers in a data set? I can 'eye-ball' it on a density plot, but it would be nice not having ...
-1
votes
1answer
31 views

Difference in multiple regression with x=factor/coefficients matrix in R

I have got 2 models. The first model uses a factor as the independent variable. The 2nd model uses a matrix with 0/1 coefficients as the independent variable. ...
0
votes
0answers
17 views

SVD of a large sparse matrix in R [duplicate]

I have a huge matrix with roughly around half a billion entries. However, the matrix is hugely sparse. If I store it as a matrix in R, it will be around 6 gb and if I store it in spare matrix format, ...
0
votes
1answer
34 views

What measures the y-axis in stat_smooth, ggplot2 in R? [closed]

I am fairly new with logistic regression. I have a binary response. And did this plot. The binary response is: Y = 0: The student fails Y = 1: The student succeed ...
0
votes
0answers
12 views

Predicting penalized multinomial logit in R (pmlr package)

I am using the pmlr package to estimate a penalized multinomial logit model, as in the example below: ...
2
votes
2answers
28 views

Hierarchical clustering with agnes - how to cut the tree?

I am working on a data.frame with both categorical and metric variables ...
1
vote
0answers
23 views

Hosmer Lemeshow test error in R

I am trying to perform the Hosmer-Lemeshow test in R, using the package "ResourceSelection". My glm model looks like this: ...
0
votes
0answers
8 views

calculation the regression weights from the distance

I'm doing a weighted regression and I wanna that the objects should be weighted depending on their distance to a defined point. Now I'm calculating the weights like this: ...
1
vote
0answers
19 views

How to distinguish suspicious leverages?

Given a linear model and the following hatvalues and influence.measures, how can I say which measurements are suspicious? I mean ...
3
votes
1answer
41 views

Generating a matrix for regression from long form data

I'm having some difficulty interpreting how to correctly create a matrix input for regression from a long form data source. I have table containing marketing data where each row represents a view of ...
0
votes
1answer
17 views

Apriori without left (before) and right (after) side

I use apriory algorithm for Market Basket Analysis in R. There is left (lhs) and right side (rhs) to look for: What customers buy before buying selected items (rhs is set, lhs is calculated) What ...
10
votes
1answer
379 views

I have a line of best fit. I need data points that will not change my line of best fit

I'm giving a presentation about fitting lines. I have a simple linear function, $y=1x+b$. I'm trying to get scattered data points that I can put in a scatter plot that will keep my line of best fit ...
0
votes
0answers
18 views

Visualizing and analyzing a time series of grid points

I have a dataset which contains numeric info about a series of grid points in a room for the entire year. The dataset looks something like this The first three digits are month,day,hour. The others ...
2
votes
0answers
17 views

R: Dynamic Regression with ARIMA model using xreg, make use of step function?

This might fit better here than on stackoverflow, I guess. I was trying to build a dynamic regression model with the dynlm package, but it did not work out. After reading this by Hyndman, I now ...
0
votes
0answers
24 views

Caret feature selection [RFE] yields different features depending on reference level of binary outcome

I'm using RFE from the caret package in R to select variables to be used in a linear discriminant analysis. The outcome is a binary factor, but depending on which level of the factor is used as the ...
4
votes
1answer
25 views

R-squared value when using offset — how is it calculated?

I have a linear model with a test score variable as a dependent variable and a vector of covariates. I have an offset variable in the model. So the formula is= $$\text{score}_i = B_0 + B_xX_x + ...
0
votes
0answers
14 views

Quantifying 1 factor count data with variable # of categories

I feel like this should be an easy question, but after lots of looking I"m stumped. I deal with continuous data almost exclusively, but in my infinite wisdom I designed this study that yielded ...
0
votes
0answers
29 views

Interaction term and logistic regression

I'm trying to evaluate the differences in habitat selection across 3 seasonal periods. I developed a model in R: ...
1
vote
1answer
22 views

Choosing between and properly interpreting Analysis of Variance vs Wilcoxon rank sum test

(Newb on this, so please assume good faith but low skill) I have this set of data where I'm interested in whether there is a significant and meaningful difference in ...
2
votes
0answers
46 views

Isn't caret SVM classification wrong when class probabilities are included?

*Please note this question is about the Platt probabilistic output and SVM class assignment, not about the code or the package itself. It just happens to be the code where I stumbled on the issue. In ...
0
votes
0answers
15 views

syntax rules for specifying multiple random effects in lme4 [duplicate]

I’m trying to get my head around the lme4 syntax for multiple random effects. I know there is lots of information out there on the topic, but I still haven’t found a source that provides clear ...
0
votes
0answers
10 views

Results from petest do not match documentation

I am trying to use the petest function in R (http://www.inside-r.org/packages/cran/lmtest/docs/petest) to decide between a log or a linear model. The documentation, and the referred textbook, both ...
0
votes
0answers
33 views

How does the logistic regression with L-BFGS have to be initialized?

I've performed a logistic regression with L-BFGS on R and noticed that if I changed the initialization, the model retuned was different. Here is my dataset (390 obs. of 14 variables, Y is the target ...
0
votes
0answers
8 views

declare class label in classifier with only X field in r

I have a simple problem: I can do SVM classification with some packages but have problem with others. let's say: my data set for training= ds and for testing ...
0
votes
1answer
25 views

How to best sample for SVM and rpart in R's e1071 package?

I built a svm and a decision tree but I noticed that when I rerun the sample then the accuracy changes. This is obviously because the sample is changing every time. What is the best way to get the ...
1
vote
1answer
77 views

Simple algorithm for online outlier detection of a generic time series II: Daily cycle within annual

I have several years of sensor data (temperature and relative humidity) that records every 1/2 hour. When the sensor dies, it often starts throwing bad data mixed in with good data before it dies ...
0
votes
2answers
52 views

What is the best model for time series data with independent and dependent variables

I have two different variables across a time series over a couple thousand time steps. I want to predict the values of the dependent variable (y) based values of the independent variable (x) in the ...