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 program in `R`.

learn more… | top users | synonyms

0
votes
0answers
17 views

How can i make a fraud detection dataset (I have the data ready but unordered)

I'm a little confused with the creation of the dataset for a fraud detection predictive model. Here i put a link with a sample of the dataset that I made. (the real dataset have ~950.000 clients). ...
1
vote
1answer
31 views

Meaning of R's coxph output

I am getting below output from coxph function in R. ...
3
votes
1answer
64 views

Specification of crossed random effects model in R

I have an experiment with a design in which subjects answer four items that are of four different types based on two factors (lets call the factors letter: "a" X "b" and big: "A" X "a", resulting in ...
1
vote
3answers
41 views

Test model coefficient (regression slope) against some value

In R, when I have a (generalized) linear model (lm, glm, gls, ...
0
votes
0answers
26 views

F test to compare regression coefficients across different groups, using R

Imagine the following type of dataset: I have a dependent variable Y, two independent variables X and Z, and a variable that can separate the dataset in two smaller datasets. I estimated 2 ...
0
votes
1answer
33 views

After trying various optimzers, model simplification running more iterations, when fitting GLMMs, R still produces warning messages

I am trying to fit GLMM's to my data using the glmer function available in R's lme4 package. The data is available at: https://onedrive.live.com/redir?resid=1B727FC7180E87DF%21118 I keep getting ...
0
votes
1answer
23 views

correct use of Negative Binomial with a Geometric distribution in a mixed model (glmmPQL)

I am trying to fit a NB GLMM with a gemoetric distribution. I have come across very little information on this form of regression. And would like some pointers/reasurance. some literature is ...
0
votes
0answers
35 views

Autoregressive distributed lag models ADL(p,q): seeking “how to” preferably in Matlab (Stata/R/Python/C# etc)

Could anyone provide me the details of how to determine the lag order of the distributed lags for an $\text{ADL}(p,q)$ model in Matlab or another statistical package (and very much preferably in ...
0
votes
4answers
96 views

How to form a predictive model in R?

I have two data sets whose structure is like this: DATA SET 1: ...
0
votes
0answers
40 views

Mixed linear models in R, help with nested terms and procedure

This is my first post, so sorry if it not optimally written. I have a paired samples at two time points in two groups, undergoing the same intervention. I want to test the effect of my intervention on ...
1
vote
1answer
32 views

Over represented gender in linear modelling data

I am fitting a model to some sales data and looking to accurately represent male/female behaviour (e.g basket analysis). For example, I know the proportion of females/males in the population buying ...
0
votes
0answers
28 views

How to make a distance correlation matrix? [closed]

I'm searching for a method or an existing package to calculate the distance correlation matrix. The package 'energy' seems only able to calculate the distance correlation between two samples. I ...
0
votes
0answers
9 views

Interpreting the relInterIntra {irr} results in R

I am using this for a reliability analysis test for quantitative values between two raters. I got my results using the "relInterIntra {irr}" package in R, but the reported values gave me several ...
0
votes
0answers
14 views

Down-sampling the majority class-How can I assure that all rows are been picked?

My doubt is about Down-sampling. I have an imbalanced data and I have use down-sampling, but I am not sure if all rows has been picked at any fold I have been use 10 folds.
1
vote
0answers
37 views

Specifying a linear mixed model in lmer with replications nested within a fully crossed design

I’m trying to specify a linear mixed model for a somewhat complicated, nested & crossed method comparison study with replicated measurements. The goal is to partition and compare variances. It’s ...
0
votes
0answers
52 views

How to develop a prediction model based on correlation in R?

I have two sets of data, say sales and profit, and I have calculated the correlation between these two data over different months using R. So currently I have ...
0
votes
1answer
52 views

How to determine which variable or combination of the variables are affecting to the predictor variable?

I have one dependent variable name as "win ration" of the deal contested and more than 30 independent variables, all are categorical variable name as role of the customer, geo, region, and 27 ...
3
votes
2answers
223 views

What is the p-value for paired t-test if the two set of data are identical

As title, I have two set of data that are identical and performed paired t-test using R, the p-value for the difference estimated (which is essentially 0) is NaN. I wonder if there can be a ...
2
votes
2answers
86 views

Reproduce linear discriminant analysis projection plot

I'm struggling with projection points in linear discriminant analysis (LDA). Many books on multivariate statistical methods illustrate the idea of the LDA with the figure below. The problem ...
0
votes
1answer
15 views

rms package, getting zero Dxy in validation of cph model

I'm doing Cox proportional hazards analysis using Frank Harrell's rms package (4.2.0), with 3 strata. My model seems reasonably predictive on training data (Dxy=-0.537), but somehow in bootstrap ...
-1
votes
1answer
38 views

Evaluating sum of slopes of a signal [closed]

I am from India, a novice in Research. Can you just tell me whether I can take a graph of an ECG signal as input and find the slope of this continuous signal at every given point in the graph. I ...
1
vote
1answer
40 views

How does one derive the survival function from an accelerated time failure model in R?

I'm currently working with accelerated time failure models. However, when I fit a model using survreg in R, the predict function ...
2
votes
0answers
63 views

Generate boxplots for a combination of categorical variables [migrated]

How would I do the following? In a single plot, I would like to create multiple box plots, each X variable being a combination of the categorical variables shown below. ...
0
votes
1answer
47 views

Number of observations in groups - linear mixed effects model

I would like to fit linear mixed effects model to my dataset, but I was wondering if quantity of observations in groups matter? I have some groups with about 60 observations in each, but there are ...
0
votes
1answer
25 views

NbClust package r error

I try to do: NbClust(city, diss =d, distance = NULL, min.nc = 2, max.nc =5,method = "kmeans", index = "all", alphaBeale = 0.1) with city is a list of number ...
0
votes
1answer
38 views

Binary logistic regression with interaction terms

I have been reading several CV posts on binary logistic regression but I am still confused for my current situation. I am attempting to fit a binary logistic regression to a series of continuous and ...
0
votes
0answers
21 views

R error in xyplot Error in units == units[1L] : comparison of these types is not implemented [migrated]

I have a problem in R with the xyplot (lattice package). For some reason I get the following error: error in xyplot Error in units == units[1L] comparison of these types is not implemented. ...
2
votes
0answers
37 views

How are the standard errors computed for the fitted values from a logistic regression with parameter 'response' in R?

I am looking for the equation for the se.fit values when using logistic regression in R. I have seen this answer - How are the standard errors computed for the fitted values from a logistic ...
0
votes
0answers
14 views

Minimum population for decision trees and association rules

Hi I'm quite new to this and I'm playing around with R and Microsoft's SSAS. Does anyone have a rule of thumb how big a data set has to be for association rules and decision trees to be statistically ...
0
votes
0answers
19 views

Obtaining sequence of lambda values for training glmnet model via `caret`

I have multiple models that I'm training using train in the caret package, all while using the same cross validation folds to ...
1
vote
1answer
21 views

How to Find Adjusted $R^2$ or $R^2$ from Lasso and Ridge regression model

How do I find the adjusted $R^2$ (or $r^2$) from Lasso and Ridge regression? I used the glmnet package. For instance if I have this code so far.... ...
0
votes
0answers
15 views

How to apply Shapiro test in R? [duplicate]

I'm pretty new to statistics and I need your help. I just installed the R software and I have no idea how to work with it. I have a small sample looking as follows: ...
4
votes
2answers
90 views

Why is power analysis with logistic regression so liberal compared to chi squared?

I'm conducting a power analysis to derive the required sample size for a study - basically compared exposed / non-exposed with 30-day mortality as outcome. I'll check for crude mortality rates with ...
1
vote
1answer
25 views

Interpreting discrimination values in IRT polytomous (grm) models. Are there any cut-offs or anchors?

I am working on a project that is looking at the discriminative properties of 6, 5-point Likert items in a scale. I am using the ltm package in R to examine this within a item response theory (irt) ...
2
votes
0answers
19 views

Generating non-normal correlated data for mediation analysis?

For a simulation study I have to generate data according to a trivariate mediation model (Baron & Kennys causal step approach). Assuming $X$, $M$, and $Y$ are continuous variables of sample size ...
2
votes
0answers
20 views

Calculating means and confidence intervals for groups with multiple observations in each subject using the NLME package in R

I need your help to identify group means and calculate the corresponding 95% confidence intervals for a set of independent samples with 2 dependent observations within each of those samples. I'm using ...
4
votes
1answer
112 views

how to discard values that are far from center of cluster in mixture model

I am trying to fit a bivariate cluster model with X and Y. What I would like to do is discard (make not clustered / un-grouped) that are far from the cluster center (for example $\mu$ + 2*standard ...
0
votes
0answers
15 views

Merge two different plots: one in the X-axis and the other in the Y-axis [migrated]

I have the represented independently these two plots using R: PLOT 1 ...
1
vote
0answers
29 views

R program- question on the mod function [closed]

I would like to multiply x with two different values based on the mod function. if (x mod 2=0) then x=x*2.15 else if (x mod 2>0) then x=x*3.15 My sample is ...
1
vote
0answers
18 views

log-likelihood for a beta-binomial in R

Although I may ask a question that is already solved (but I found none that would explicitly refer to this), I would like to know, if (and I am no statistician) I am right with programming the ...
0
votes
0answers
9 views

Find the 2 max values for each factor in R [migrated]

I have a question about finding the two largest values of column C, for each unique ID in column A, then calculating the mean of column B. A sample of my data is here: ...
1
vote
0answers
22 views

issue in finding correlation in R [migrated]

I am trying to find correlation between two separate data sets in R. The structure of my first data set is (when used ...
1
vote
1answer
19 views

Optimise selection from a set, with constraints

I would like to use R to solve a problem I have. I don't even know what to call a problem of this kind and I'm finding Googling difficult. My guess is that this kind of problem already has R ...
3
votes
1answer
60 views

Is there an R package for MCMC estimation of Generalized Method of Moments?

I'm looking for an R package (or a combination of packages) that would allow me to perform MCMC estimation of a GMM model, with a user-specified moments function. I've looked at the CRAN Bayesian ...
0
votes
0answers
16 views

Strange: Partial Correlation changed correlations values to be negative?

I am trying to investigate the correlation values. A big problem happens. The method I used is in corpcor package in R. I have a column as missing data. I firstly calculate the correlation matrix. ...
0
votes
0answers
17 views

Hierarchical clustering of repeated measures in a few locations

I have a water quality data (value) measured 10 times (every month - data) on three depths (shallow, medium, deep) in five location (A, B, C, D, E): I want to find in which location values are ...
2
votes
1answer
41 views

Cross-validation with dummy variables?

Does it make sense to use cross-validation with factor variables that have 3+ levels? When using bestglm, I get an error saying that it doesn't work with categorical variables. In the documentation ...
1
vote
0answers
17 views

How to give an input when you are using Machine Learning method in R

I am new to R and machine learning algorithms. I have basic knowledge of different machine learning algorithms. I have four years of daily sales data.I am trying to predict sales using Support Vector ...
-1
votes
0answers
22 views

How to compare a Cox model with a neural network model [duplicate]

I am trying to compare a Cox model with ANN in R, but I have some problems: The result of package coxph is a hazard rate, but the result of package ...
1
vote
1answer
76 views

Count data on proportion or different kind of type?

I really do not know which kind of variable my response data is. I cannot find any answer to my question in the world wide web. I have the results from a survey of 900 farmers. Each farmer told how ...