# Questions tagged [r]

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.

21,132 questions
Filter by
Sorted by
Tagged with
2 views

### Zero-Inflated Negative Binomial Theta and Incident Rate Ratios (IRR)?

I am trying to determine the best regression model for data with many zeros; I have about 200 with non-zero DS scores and 600 with zero DS scores. ...
3 views

### Difference between MORAN.TEST and LM.MORANTEST functions R

I need to check the spatial autocorrelation in a GLM but I'm confused about which is the function that I need to apply. I get different outputs from each one of them. I think that in the case that I ...
5 views

### Calculating s2 of matrix b

I'm attempting to calculate s^2_b of matrix b, reproducible in R below. ...
9 views

### Cooks Distance for multiple observations

I would like to determine the combined influence of a group of observations on a linear regression model, but I am not entirely sure how to compute the Cook's Distance for that. I know that for a ...
4 views

### fitting suitable regression model to identify predictors from contingency table

so a study was conducted for some game and the probability of success of the game was noted in a contingency table. I have a 5x5 contingency table which is age group by task difficulty(split into ...
11 views

### Interpretation of 1-pchsisq [duplicate]

I know that Q = pchisq(lower.tail=FALSE) can be interpreted % probability of obtaining a set of measurements as discrepant of these or worse if the model is correct. But what does 1 - Q tell us?
7 views

### Determine Cointegration in time series

I am working on a series where my dependent variable is stationary, performing the dikey-fuller test to the original series (it does not differ) is stationary, this means that my series is integrated ...
11 views

### Time series regression analysis with GAM in a factorial design

I have data from 16 automated sensors that measure a parameter across 4 experimental treatments with 4 replicated experimental units each: How would I go about to robustly test for significant ...
38 views

### Test if two coefficients are statistically different in negative binomial regression in R?

I am currently working with negative binomial regressions and I would like to test whether two coefficients in the same model are significantly different from each other in R. I have read on some ...
24 views

### Bayesian model comparison vs Bayesian Model criticism

What is the difference between Bayesian model comparison vs Bayesian model criticism? Can someone explain with an example?
16 views

### When should we need to rebalance a test set in R [closed]

Balancing is almost always performed on training set and we generally do not perform balancing on test set. I was uncertain about the usage of a test set. Like what kind of contexts that we should ...
18 views

### How to simulate a sample from log skew t distribution in R

How I can simulate a sample from log skew t distribution with lambda equals to 0? I didn't find any packages can do it and I'm not so in order to write a function. Can someone help me to understand ...
20 views

### is it correct to use a Pearson correlation test on transformed data (log, boxcox)

I am trying to study the correlation between 2 variables non-normally distributed. These are the values (n. 134) of measured level of a substance (bisphenol A) in urine in mothers and relative ...
21 views

### Output of xgboost() while optimization is not very intuitive

I am running xgboost() on a data set with a data set with below columns. ...
17 views

### R: About gamma distribution [closed]

It's a very silly question, but I start learning R recently, hope I can get some help from you guys If 60 cars pass the intersection of rd.A and rd.B every minute, find the probability that at most 2 ...
10 views

### Interpeting multilevel logistic regression

I ran a multilevel logistic regression, and I rescaled the variables using the scale function. The variables in my data set are centered around the mean and ...
29 views

### Model selection for Mixed Effects Regression - Correcting heteroscedasticity

My experiment consist on measuring the root mean squared error (RMSE) between a path and what the participant produces. To produce the trace each participant experiences 3 feedbacks (1st factor - ...
9 views

### interpretation of plot_features output in LIME- supports vs contradicts output doesn't match the sign of feature_value * feature_weight [closed]

I've created a GBM model explanation using LIME and have used plot_features to plot the results. I'm confused by the mismatch between the output of the plot, in terms of Supporting and Contradicting ...
32 views

### Filling missing data points with lmer prediction model

I'm trying to interpolate the missing data point using lmer model prediction. Subsetting to a table without any na to the missing column of interest: ...
20 views

### Is a Two sample T-test appropriate for my data?

sample 1: 9, 13, 30, 23, 34, 43, 39, 113, 4, 5, 11, 17 sample 2: 16, 25, 22, 67, 88, 43, 59, 39, 69, 93, 41, 231 The data is unpaired I want to calculate a confidence interval for the difference in ...
6 views

### Calculating quantiles of pooled-sample NHANES PCB data

I am comparing PCB laboratory results to NHANES population quantiles. This is straight forward with 2003-2004 data. R code: ...
10 views

### Interpretation R results linear Model with Interactions

I´m trying to analyse the effects testosterone in combination with a specific pill type can have on reactiontimes.For example, if there is a difference in the reactiontimes between people who have low ...
19 views

### Gibbs sampling for simple posterior distribution?

I have a likelihood function, $$p(x) = \theta^{\sum x} (1- \theta)^{n-\sum x}$$ and prior distribution, $$p(\theta) \propto \theta^{\alpha - 1} (1- \theta)^{\beta - 1}$$ then the posterior ...
16 views

### Is K = 1 is good for KNN, when error is min, accuracy is max and even AUROC is Max for that value of K?

I am getting highest Accuracy for K =1 in KNN, Max AUROC, and lowest Error. however, I was taught that when K = 1, then its always going to be over-fitting mode, and hence I am asking the question is ...
5 views

### Add summarizing labels in facet plot [closed]

I created an example data set to make this more clear. Lets say I have 5 different species of flowering plants. They can have 3 different colours and I find them in 3 different locations: ...
13 views

### Optimal matching analysis for proportional data

I have a dataset constructed from twitter data consisting of users, and their proportional activity in an issue. The data is currently stored as a dictionary of dictionary: Current format: ...
16 views

### Forecasting a not-seasonal time series in R

I would to forecast a not-seasonal time serie in R. This is my serie and the model built with HoltWinters: ...
13 views

### Questionable results for Mahalanobis distance

I'm trying to detect outliers in my multi-variable dataset using Mahalanobis distance. In the picture below is a sample of my data and the distance results. I'm wondering why the difference between ...
21 views

### Calculate CI for only a part of the data frame [closed]

I have this data frame and need to calculate separate CI for the means for males and females (male=0, female=1) for each Af, Bf, Cf and Df variables. How can I do that, my data frame is actually much ...
10 views

### Importance function random forest to create a logistic regression

I have created a random forest function, the dependent variable is a binary variable (either 1 or 0). When I do the importance of my random forest, it gave me the %IncMSE. Regarding it is logistic ...
23 views

### Why do the calculated means in lm() differ from emmeans()?

Let's assume we have the data: ...
16 views

### R square output in lrm function : Is it a pseudo or not? [closed]

Using rms package, I was wondering if the r-squared in the output of the lrm function in R is a pseudo-R or just a R-square like for a linear regression? Thank you,
14 views

### Pseudo $R^2$ for glmnet

I have made a logistic model through glmnet. In the process of calculating some validation statistics, one statistic I would like is Nagelkerke $R^2$. However, ...
8 views

### Kaplan-Meier and Cox in R give different results

Please, can you explain, why these two formulas give different answers? Is this because Cox is a semi-parametric method and KM is non-parametric one? I marked the differences with asterisks. Kaplan-...
10 views

### R: Multiple Comparisons on glm() model with nested effect [closed]

Thank you for your patience as I am not a statistician. I have a simple goal: to run a glm() model and get p-values for all pairwise comparisons between levels of a certain factor while correcting for ...
24 views

### The precision recall AUCs calculated by two different packages are different?

I used the dataset cars as an example ...
16 views

### Variance of Coefficient of Probit estimation with 500 random draws

this is my first post here, I try to be as specific as possible. If a forgot anything important, please tell me :). I have data with 100.000 observations about cellphone providers. The data can be ...
12 views

### Fault tolerant sorting algorithm in R [closed]

I would like to create and trial a self-descriptive questionnaire that uses pairwise comparisons of 20-40 statements (e.g which one describes you better: makes quick decisions or finds the weakness in ...
13 views

### Approaches to Processing exam results [closed]

I am trying to process around 8000 exam results I have put these in a datatable. What I would like to know is how you would go about processing this data from a statistical point of view. I have ...
13 views

### What are the limitations of non-negative matrix factorisation when reducing the dimensions of a data set?

From what I understand NFM (non-negative matrix factorisation) is constrained by the factor that it only supports data sets with non-negative values when reducing the dimensions of a data set. ...
19 views

### What is meant by the “column vector Rij” “p x N matrix R” and “p x 1 vectors Ri. bar and R.. bar” in this paper?

I am in the process of turning some statistical equations in this paper into an R script that will allow me to read my data into the workspace and produce a test statistic for the ANOVA-type test ...
49 views

### GAM Interactions : Individual and Combined Interactions are different

I am quite new to GAM, I was trying various interactions in my GAM models, the individuals interactions and combined interactions are not coming up the same. There are three variables which define my ...
11 views

### R - basic vectors' statistics questions [closed]

I am just starting my steep learning curve in R, its' statistical aspects specifically, and currently want to tackle the following. I created the following random vectors: ...
40 views

### Residuals in regression

When evaluating residuals for a linear model, do we plot them against the fitted values or the x values. Here I have an example in R. Do we want the first or second ...
12 views

### Delimit the area in that parameter space that contains 95.4% confidence

Given the equation $y = fc + fe\times \sin(2\pi(x-t_0)/12)$ Considering the two parameters of amplitude fc and fe simultaneously, delimit (using the χ2 variation method) the area in that parameter ...
17 views

### “Count” in apriory (R). What is “count”

I use the rules <- apriori (tr, parameter = list (supp = 0.0015, conf = 0.8)) I use @inspect (rules)" Further I see standard description lhs rhs support confidence lift count  {liquor, ...
20 views

### Data generation process from an given regression model and monte-carlo experiment in R

I want to generate data in R to solve the following problem: Consider the following Data Generating Process (DGP) $Y_i = β_0 + β_1 · X_i + β_2 · Z_i + u_i$ , where $β_0 = 0.75$, $β_1 = 0.50$ and \$β_2 ...
14 views

### How can I find bias in mlp() RSNNS? [closed]

I would like to train a database by ANN changing the learning function (Std_Backpropagation, BackpropBatch, BackpropChunk, BackpropMomentum, BackpropWeightDecay, Rprop, Quickprop, SCG...). With the ...