The Stack Overflow podcast is back! Listen to an interview with our new CEO.

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
0answers
7 views

Difference lemmatizing/stemming when preprocessing text to organize abstracts looking for document insights?

I'm working with R text2vec in order to apply an LDA on a 230k text data that I have on hand. I tried both stemming and lemmatizing separately but I am not completely aware of which gives out the ...
0
votes
0answers
17 views

Generating marginal posteriors from MCMC output in two-factor model

Quick summary: if I have a MCMC sample of the posterior distribution of two factors and their interactions, can I marginalize out one factor simply by concatenating the posterior samples from each ...
6
votes
1answer
66 views

Kolmogorov Smirnov p-values not uniform under the null in R?

It is well known that the distribution of the p-value in a statistical test is $U(0,1)$ under the null. Now, consider the following implementation of the two-samples Kolmogorov Smirnov test on normal ...
0
votes
2answers
44 views

How to calculate the probability of getting a specific value in a random subsample in R?

I have 73 houses categorized as positive (1) or negative (0) for a disease. Each row (73) is a house and only one column with the values. ...
0
votes
1answer
13 views

Possible reasons for AUC=1 (from a fitted glm model)?

I am running high-throughput microarray data (methylation array), and after running univariate, lasso and cross-validation lasso analyses, I was able to come down to a list of 15 probes (predictors). ...
0
votes
0answers
14 views

Conditional heteroscedasticity for the tobit model in Layman's terms

I have been using the crch package for modelling censored data with the tobit model. I noticed early on that the errors (by far) are not normally distributed by ...
0
votes
0answers
5 views

Does negative Z score in Cochran-Armitage test implies the presence of an increasing trend?

Given the p-value is less than 0.05 does negative Z score in two-sided Cochran-Armitage test implies the presence of an increasing trend?
0
votes
0answers
14 views

Croston's Method (forecast)

I ran Croston's Method on this data(Sales) with h=3 ...
0
votes
1answer
21 views

How can I calculate principal components scores in a compositional data PCA?

I hope someone can help. Please let me know if my question is not clear. I have compositional data, where there are three variables which sum to 100% for each row, something like this: ...
0
votes
0answers
5 views

Variance Inflation Factor on many variables

I have a good amount of variables, where some/most of them are highly correlated. Like roughly 80 variables, and then maybe 50 are correlated in groups. So 20 of the 50 are highly correlated, and the ...
1
vote
1answer
19 views

Measuring variation explained in community matrix using both geographic distance and and environmental variables

So I have this dataset where I have species community data from a variety of sites. I’m trying to explain what are the factors that drive the variation in these data. For each site, I have a ...
0
votes
0answers
21 views

Can knn be used for multivariate multiple regression?

I am working with MLB data with around 15000 observations for seasonal player stat. The data frame's structure looks like this (I'm making up the stats): ...
-1
votes
0answers
14 views

Why do I get a different p-value when using summary(table(DF)) vs. chisq.test(table(DF))? [closed]

I have a dataframe (DF) that consists of 2 variables with ~43500 observations. The first variable is a numeric (1-6), the other is a factor with 2 levels (PRE & POST). Why does R give a different ...
0
votes
0answers
11 views

randomForest prediction for zero-size nodes

I have just realized that despite the documentation ...
0
votes
0answers
11 views

Can binary data be used in ordinal regression models?

Basically I have some code which runs a lot of calculations originally on some ordinal response variable and some predictor variables, and it is based on the VGAM R package. As such, it seems like it ...
0
votes
0answers
14 views

Do adaptive lasso, group exponential lasso and composite MCP methods have the same optimization algorithm of the likelihood function?

As part of survival analysis and variable selection, I would like to compare adaptive lasso, group exponential lasso (gel) and composite MCP (cMCP) methods. In terms of cross-validation, do these ...
0
votes
0answers
15 views

Interpretation calibration plot RMS package

From what I understand from earlier postings the calibration plot in the RMS package can be useful : " Now with pure calibration accuracy you can sometimes judge a model to be inadequate no matter the ...
1
vote
0answers
14 views

Deciding upon the important regressors for a SARIMA model

I have 14 months(01/07/2018 to 30/08/2019) of one minute data, which I have aggregated to 10 mins block. So I have a data of dimension "61056 * 350". From this I am using 12 months of data to train ...
1
vote
1answer
23 views

parameter n in p.adjust function in R [closed]

I'm quite confused about the n parameter in p.adjust function. p.adjust(p, method, n = length(p)) where n could be changed. but the default is length of p as stated in the documentation. So in my ...
1
vote
2answers
26 views

2-sample t-test VS Mann-Whitney test - one group is not normally distributed

I'm comparing two groups of data. One group has a sample size of 30, and the other a sample size of 45. The second group is not normally distributed, and thus this violates the normality assumption. ...
0
votes
0answers
22 views

survreg predict default options

Given a suvreg model, for example, lfit <- survreg(Surv(time, status) ~ ph.ecog, data=lung) I get the same result if I ...
1
vote
1answer
37 views

Clinical trials simple randomization scheme simulation [closed]

I'm trying to do 1000 simulations for how to randomize 100 patients to two treatment groups (A and B) using simple randomization scheme (with probability 0.5) and figure out what is the chance of a ...
0
votes
0answers
37 views

Residual diagnostics for tobit model in R

I'm starting my first tobit model analysis in R and I face the following problem: When I compute the residuals of the tobit model, the residual set remains empty (NULL). I have added a minimal example ...
0
votes
0answers
18 views

How to better understand when to use Weibull AFT versus Cox Model for Failure Data

I am struggling to understand when I should consider using a Cox regression model versus using a Weibull AFT model to predict the end of life of mechanical components. I have tried to apply the Cox ...
1
vote
1answer
24 views

Why is the exprected value of a sum of RV following a Z-distribution not equalt to 0?

I am using R to draw a thousand of RVs from a Z-distribution. I noticed that the expected value of their mean is as expected ~0 (magnitude 10^(-4)) sometimes positive, sometimes negative but; the sum ...
0
votes
1answer
20 views

t test in R to see if mean 1 is lower than mean 2 [closed]

How do I compute a test in R to see if, in the AML group of the golub dataset, the mean expression value for gene 808 is lower than the mean expression value for gene 1042?
0
votes
0answers
8 views

Regressor ordering in randomForest [closed]

Consider this example. First, setup the workplace. ...
0
votes
0answers
18 views

What analysis should I use?

I have a dataset with 5 years of data, and am looking at trends in outcomes over time - so I have a categorical independent variable of Year, and 7 dependent variables, 5 of which are boolean, 2 of ...
0
votes
0answers
14 views

phylogenetic multilevel model in MCMCglmm

I'm trying to run a mixed phylogenetic model using the MCMCglmm function in the R package of the same name. In this model, I want to estimate slopes and intercepts ...
0
votes
1answer
34 views

What good is an F-test and is using it as a test for significance of independent variable worth it?

An F-test may lead to the conclusion that a predictor is significant by an F-test low p-value. This is because while an independent variable like smoke (below) is statistically unimportant (high p-...
0
votes
0answers
3 views

Using BCNPower Transform (car) and emmeans [migrated]

The car package in R implements Box-Cox with non-positives (BCN). This is not a standard Box-Cox transformation, although it builds on it. The emmeans package can handled transformed data. It can ...
1
vote
0answers
33 views

How to measure carryover effect in a crossover design 3x3?

I'm trying to analyse a potential carryover effect from a study with a crossover design 3x3, three treatments and three periods. My data has a latin square design with the treatment sequences CBA, ...
0
votes
1answer
41 views

Specifying a New Variance - Covariance Matrix for a GLM Model

I am using a multistep regression to estimate price elasticity coefficients. To correct for heteroskedasticity, I am using the vcov function, which provides a new variance-covariance matrix. Once I ...
0
votes
1answer
47 views

Simulation in R of data based on Cox proportional-hazards model

I would like to fit data based on Cox proportional-hazards model and then simulate new data based on a fitted model. For instance, provided that the fit is ...
4
votes
2answers
73 views

Behaviour of Welch's t-test with unequal group sizes

It seems that in some cases Welch's t-test can give inflated p-values with imbalanced group sizes. For example, consider the following simulation of unequal group sizes sampled from the same Gaussian ...
0
votes
0answers
5 views

In-Bag Risk Reduction Interpretation - glmboost Variable Importance

I'm currently working wiht a 'glmboost' model, from the 'mboost' R package, and I want to analyze the variable importance. There is a function called 'varimp' that returns the "In-bag risk reduction ...
0
votes
0answers
46 views

Short term(10 mins period) forecast using ARIMA

I have 14 months(01/07/2018 to 30/08/2019) of one minute data, which I have aggregated to 10 mins block. So I have a data of dimension "61056 * 350". From this I am using 12 months of data to train ...
2
votes
0answers
29 views

Generalised Logistic Regression with mixed effects - Binomial model creation / selection

I have a dataset with 72 individuals from 5 separate groups, with repeated measures - each individual was sampled 4 times. All data is binomial, and in most cases there are more 0s than 1s. I have a ...
1
vote
3answers
36 views

R Logistic regression and correlation

I'm having trouble understanding the output of this logistic regression in R. Data ...
0
votes
0answers
25 views

Generate a multivariate wind speed (my variable daily) model using the copula method [closed]

My request is how can I generate a multivariate wind speed model using the copula method in R including: Determine the marginal distributions of wind speeds at each wind site from wind speed data. ...
0
votes
1answer
35 views

Multiple linear regression takes into account more variables and adjusts the value of estimates and p-values, why then use linear regression?

Note the difference in Wr.Hnd of multiple linear regression is nearly halved to that of linear regression. The same applies to SexMale (not shown). Case in point: Multiple Linear Regression ...
0
votes
2answers
37 views

How and when to perform a two sample t-test or a two sample z-test?

I have a data set about 5,699 PhD students. The first column called "Year" is how many years it took for candidate to graduate with a Ph.D (1, 2,...14), the second column "Uni" is which university the ...
1
vote
1answer
27 views

Simple computational misunderstanding in Ljung-Box test

The Ljung-Box test statistic $Q$ is defined as $$ Q := n(n+2) \sum_{j=1}^{\ell} \frac{\hat{r}_{j}^2}{n-j}, $$ where $\ell$ is the number of lags and $$ \hat{r}_{j} := \frac{1}{\left\|a \right\|_{2}^2} ...
0
votes
0answers
6 views

Whats the difference between uncorrected and corrected Kendall's W - Kendall's coefficient of concordance? (synchrony R Package)

The synchrony R package has a function to calculate Kendall's coefficient of concordance also known as Kendall's W: kendall.w. The function has two outputs for ...
0
votes
0answers
13 views

Difference in differences regression with treatment at different times for different countries

I found an article about DID regression online: https://www.princeton.edu/~otorres/DID101R.pdf As far as I understand the countries A, B, C and D are the control group and E, F and G are the treatment ...
0
votes
1answer
23 views

tsCV auto.arima with xreg results in NAs

I'm using the tsCV function from the forecast package in R. I'm comparing arima with and without xreg. Without xreg I have no problems. But when I add xreg to the tsCV function I get a matrix of NAs. ...
0
votes
1answer
28 views

k-means method clarification

I am pretty new to k-means and cluster analysis methods, but I am trying to do it on 5 different measures of inequality and redistribution (Gini, P90/P10, Atkinson with different parameters and the ...
0
votes
0answers
35 views

How and when to perform a two sample t-test or a two sample z-test?

I have a data set about 5,699 PhD students. The first column called "Year" is how many years it took for candidate to graduate with a Ph.D (1, 2,...14), the second column "Uni" is which university the ...
0
votes
0answers
25 views

Is X a better predictor for Y in condition two?

I have a question about how to structure data and include it into a linear model to answer the following hypotheses: Hypothesis 1: I'd like to test a hypothesis about people choosing earlier ...
0
votes
0answers
14 views

How to interpret the kruskal wallis test in r

I am trying to understand the results on the kruskal wallis test that are produced in R. The data that I am testing: ...