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`.

Filter by
Sorted by
Tagged with
0
votes
1answer
15 views

Table of means and paired-tests

So I am having a rather simple problem of how to create a table of means in R and post-hoc t-tests. Data: DV: Score (Continuous variable) IV1: Country (Nominal, 3 levels) IV2: Group (Nominal, 4 ...
0
votes
0answers
11 views

Statistics help! How to report results!

I am new to statistics and I need some help in understanding how to report the data of some tests I am running on R, I hope this is the right place! I have a dataset: ...
0
votes
1answer
13 views

Glmer: output of model when scaling a continuous dependent variable

I'm exploring the use of generalized linear mixed effects models with lme4's glmer function and I have a question regarding the scaling of independent (continuous) ...
2
votes
1answer
523 views

clustering for data with too many features

I have a data set of information about different products that I want to cluster similare ones so I can do pricing on them. Each product have at least ten features that I can consider to differentiate ...
1
vote
0answers
24 views

Can you use regression to predict values if you imputed data using MICE?

I used multiple imputation on a data set that had some missing values (I had to do this as the sample size was low so I couldn't just exclude the NAs). I know you can do ...
2
votes
0answers
11 views

How to properly report logit model using glm in R?

Hi I have a very simple logit model. Vitamin B-12 (nano gram/ml ) was taken from two groups headache vs normal. I dummy coded headache group as 1 and normal as 0. the model is ...
0
votes
0answers
13 views

How can I bootstrap a CI in R for likelihood ratio? (sensitivity / 1 - specificity)

I have a test that attempts to classify samples as positive cases or negative cases based on a score. We can somewhat vary the score's threshold for what we call a positive or a negative case to ...
2
votes
1answer
15 views

What stats should you include on poisson regression plot

I have this quasi poisson regression plot and I will be presenting in at a conference (obviously it will look better than this). What statistics should you be presenting? I know likely the p value and ...
3
votes
1answer
163 views

Thin Plate Regression Splines mgcv?

I am struggling on the understanding of thin plate regression splines. I already found a very helpful answer here in cross-validated: smoothing methods for gam in mgcv package but I still have some ...
2
votes
1answer
26 views

How to run mixed effects models with lots of 0's

I have ecological data (transects as the unit) from inside marine reserves and matched control transects that I would like to test the difference across 18 separate response variables. These are 3 ...
0
votes
0answers
19 views

Statistician's quantiles versus policymaker's quantiles: calculating the variance correctly

When speaking of income, although statisticians and policymakers (and their staffs) both refer to deciles, quintiles, and the like, they mean quite different things by these terms. When a statistician ...
0
votes
1answer
153 views

Interpreting interactions when main effect is not significant

I just started fooling around with R and I am quite struggling with mixed models: I have the following experimental layout: Seven different viruses, including ctrl virus; 27 mice, randomly infected ...
0
votes
2answers
16 views

ANOVA comparison between genders controlling for additional factor

I am interested in finding out exam results differ between gender, controlling for the school the students attended. For now i have done ANOVA comparison of exam results. There are significant ...
2
votes
1answer
1k views

R, rpart(), classification tree, cptable$xerror

i randomly split my data into training and test sets. then using the training set, i construct an overfitting classification tree with 10-fold cross-validation. i.e. xval=10 and prune it (with ...
3
votes
2answers
3k views

Smoothing methods for gam in mgcv package?

I am currently working with gam models in the mgcv package and for me the smoothing methods are a bit confusing and I hope that you guys can help me to understand that better. So here is what I've ...
0
votes
0answers
8 views

How to use sobol2002 for sensitivity analysis in R?

I have a very basic understanding of R and stat so my question may sound very simple. I am trying to do a sensitivity analysis on a model that takes 30+ input parameters. The model is created in R. ...
5
votes
1answer
100 views

Peeking Inside the Black Box, can Feature importance indicate overfit?

my basic question is: can permutation feature importance be used to identify overfitting? when you have a binary classifcation problem with balanced classes (i.e. 70 x yes, 70 x no), when none of the ...
1
vote
1answer
711 views

How to do multivariate outlier detection in mixed data with category?

I have a data table where the entries are in the following format. The first column is category, which represent the product category. I have 5 such categories. ...
2
votes
0answers
51 views

Exploratory data analysis before pefrorming Canonical Correspondence Analysis (CCA)

I want to perform CCA, but I read that, remember that observations (for example, species abundances) have to present unimodal distributions along gradients (for example, environmental variables). ...
2
votes
0answers
19 views

How do I develop a spatial regression model when the Y and X points are partially misaligned? Do I have to use a grid?

What concept would I use to develop a spatial regression model for misaligned Insurance Claims and Policy data? For example, consider a situation where I have 1000 points that represent policies, and ...
0
votes
0answers
23 views

Limit the upper predicted values in r

I'm trying to predict rainfall. But the log model gives very high prediction for certain values. Please check the plot for actual vs predicted values. Is it possible to limit/restrict the upper ...
-1
votes
0answers
17 views

How to add observation points onto the two-dimensional density figures? [on hold]

I want to reproduce the "Figure 4" of this article named"Probabilistic estimates of drought impacts on agricultural production",with the link"https://agupubs.onlinelibrary.wiley.com/doi/pdf/10.1002/...
1
vote
0answers
32 views

Friedman test for rank order question - Comparing between groups

In my study, participants ranked a total of 5 designs (different lamp types) in their order of preference (absolute favourite, second favourite, etc.). Participants ranked all lamps, and lamps were ...
1
vote
0answers
20 views

Generate synthetic data given AUC

I'm experimenting with ROC-AUC for binary classification problems. I want to generate synthetic data for a given AUC score. The ...
0
votes
0answers
17 views

Variable Importance Intepretation for GLM

I'm having a confusion and can't find any answer from the docs.ai that H2O Team provided. I'm creating a summary from my glm and receive a variable importance table. But i can't understand what is ...
0
votes
0answers
6 views

Interpretation of a Generalized Dissimilarity Model result

I have used a GDM model (Ferrier et al. 2007) (function gdm; R package gmd_1.3.11) to find the best predictor (environmental and geographic distance) of species compositional change across an ...
1
vote
1answer
57 views

Dynamic Time Warping vs Cross Correlation

Consider the following data frames: > df1 value 1 6 2 2 3 3 4 1 > df2 value 1 3 2 8 3 4 4 5 I want to find the ...
0
votes
0answers
15 views

issue in finding goodness of my model while running linear regression on Rstudio

i am running a linear regression on a dataset in Rstudio. the R-squared value is 0.2916 , vif(fit) is less than 2 for all significant variables. Mape is 0.3410576.The p-value in Dwt(fit) is 0.902. In ...
0
votes
1answer
16 views

Interpret a ANOVA table with treatment taking basliene value into account

I have the example data below. I wonder how I should interpret the BL value from the ANOVA table, 0.0194391. It means it is significantly different from zero, but putting that into the context, does ...
0
votes
0answers
12 views
5
votes
1answer
5k views

How to view GBM package trees?

I am trying to view the output from the GBM package for boosted trees in R. Below I am fitting a single tree without any sampling in order to compare the tree to the complete dataset. First, create ...
0
votes
0answers
17 views

Reporting several ols models graphically

I am planning to run ols models across several datasets (50+) and I am wondering how I could sufficiently display the results graphically. I am inspired to do this with consideration of the following ...
0
votes
1answer
20 views

Twoway fixed effects with pglm (and plm) package [on hold]

I'm trying to estimate a poisson model with location and time fixed effects using the pglm package in R but noticed that including the time index has no effect on the output and seems to be ignored by ...
1
vote
0answers
37 views

Multiple regression: How to calculate required sample sizes for individual predictors (preferably in R)?

I'm doing a multiple regression analysis in R on an epidemiological data set with five predictor variables as follows: y ~ x1 + x2 + x3 + x4 + x5 With my data (n ...
3
votes
2answers
44 views
+50

How to do within group moderation analysis without subsetting data

Let's say I run the following regression specification: lm(outcome ~ treatment) Where treatment is a factor variable that can take four values ...
0
votes
2answers
25 views

Delivery delay in days - discrete or continuous?

I am working on a task and I am unsure if my data is continuous or discrete. I have data about the delivery time from a production to an assembly factory. The time is measured in days, for example 2,...
0
votes
1answer
146 views

multgee for repeated measure multinomial regression

I am trying to analize my experiment results according to the multgee reference pdf, but I have some warning message. My dependent variable is a 5 level categorical variable. I have 12 eyes of 6 rat,...
1
vote
1answer
33 views

Schoenfeld test (cox.zph) shows no covariate violates PH assumption but global test suggests whole model does (p<0.001). What to do?

Using cox.zph (part of the survival package), I find that no covariate violates the PH assumption in a Cox regression model (p > ...
0
votes
0answers
13 views

Cointegration in R: getting relevant information from `urca::ca.jo` output [on hold]

I am performing the rank of cointegration test in R using Johansen Tests hence ca.jo from urca in R. Furthermore I am following ...
1
vote
2answers
42 views

R chi square test with degrees of freedom

Does anybody know of a chi-square test function in R for which you can specify the degrees of freedom? Example: I want to test if the Hardy-Weinberg distribution holds true for a sample of the MN ...
0
votes
2answers
64 views

Are feature selection methods prone to multicollinearity? [duplicate]

I'm using R and I wonder whether I should first remove highly correlated variables via vif()and apply then lasso, forward selection etc. Or doesn't it matter? Do ...
1
vote
0answers
31 views

Ordinal Logistic Regression in R - Understanding coefficients

I am creating an OLR model using R with the polr function in the MASS package. All of my predictors are also ordinal data, all of the data is the integers from 1 to 5 coming from a customer survey. I ...
2
votes
2answers
2k views

Special method for forecasting on time-series clusters in R?

I'm doing a project related to identifying sales dynamics. My database contains 26 weeks after launching the product (so 26 time-series observations equally spaced in time). I used two methods of ...
0
votes
0answers
6 views

Increasing row numbers after TDM transformation

I have just started working on R text analysis and have the below issue going on. The dimensions for my Termdocumentmatrix increases from the original number of rows I started with the review data to ...
1
vote
1answer
29 views

How to use just one tree in a random forest with the R package randomForest? [on hold]

With the R package randomForest, I can get a forest for classification. With the function getTree(), I can get each tree of the forest. Now, my question is how to do classification for a new input ...
9
votes
2answers
6k views

Error when running glmnet in multinomial [on hold]

The problem mentioned in this question is fixed in version 1.7.3 of the R package glmnet. I'm having some problems running glmnet with family=multinomial, and was wondering has encountered something ...
-1
votes
1answer
27 views

What does PC1 mean in prcomp output?

I'm having trouble trying to understand the output of the prcomp function from package stats in ...
1
vote
2answers
517 views

LMG don't sum to model's R2

I have a regression model and I want to determine the relative importance of the predictors. I used the package relaimpo in r. The package says that 98.84% of the ...
4
votes
3answers
8k views

Python vs R for Text Mining Preprocessing [on hold]

I've been reading some articles on cleaning text data before doing text mining analysis on it. I have experience in both Python and R and am wondering if one of these languages is an obviously better ...