Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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

0
votes
0answers
6 views

Choosing prediction model with regularization, spatial cross-validation and bounded predictions

I am new to machine learning and R. I want to run a statistical model to predict daily hours of supply of electricity (y). I have several x variables to use for prediction. I have three goals to ...
0
votes
0answers
10 views

Using State Fixed Effects in R

I am trying to run a regression with only state level fixed effects, but not time fixed effects. I am trying: ...
0
votes
0answers
5 views

Help setting up a contrast in R for DESeq2

I'm working on a case/control study and including some other variables such as genotypes. One thing I want to do is a subgroup analysis of the genotypes for just the case group. The brute force method ...
0
votes
0answers
18 views

singular fit with lmer (lme4) with single random intercept

I'm running a mixed model with the lmer function from the lme4 package in R and ran into some issues with singular fits. I get the warning message 'singular fit', ...
0
votes
1answer
8 views

Anova of a mixed effect model (lmr) shows no significant interaction while tukey (emmeans) does?

I have run a linear mixed-effects model using lmer package. I'm using year sampled (1990s or 2017), field(1967 or 1984), and treatment (open or closed) to determine differences in native herbaceous ...
0
votes
0answers
8 views

PCA OF multivariate dataset [on hold]

In my experiment I work with grafted plants, therefore I do have 3 combinations (A/A, A/B, and A/C) these combinations with two treatments (Control and Heat), and three-collection points (vigorous ...
0
votes
0answers
15 views

Testing for annual patterns of sex ratio without time series analysis

I have data on the number of males and females from a single population, sampled approximately monthly for about five years. The hypotheses to test are: The sex ratio is skewed There is a trend ...
0
votes
0answers
17 views

Eigenvalues and Eigenvectors in R [on hold]

I have calculated the eigenvalues and the eigenvectors for a data set using r command. They are as follows; ...
0
votes
0answers
23 views
0
votes
0answers
10 views

Coefficient omega: appropriate extraction of factors

I use omega_hiearchical to determine the internal consistency of a scale. If I understood it correctly, it tries to extract three lower level factors by default. But you can specify that you want to ...
1
vote
1answer
17 views

plnorm and log scale parameters

I have expenditure data in several regions, and for each of them i know mean expenditure, standard deviation and skewness in original scale. Since data are skewed i want to compute probability of ...
0
votes
1answer
30 views

How to generate a conditional random variable in R? [on hold]

Suppose there is a sample $X\sim N(0,1)$ x<-rnorm(100). If I want to generate a conditional random variable $Y|X\sim U(0,1)$, how can I get this conditional ...
2
votes
2answers
16 views

Why does pROC roc work with non-probability predictions?

With the pROC package, I can do this: true <- c(1, 1, 1, 0) predicted <- c(0.5, 0.1, 0.6, 0.1) roc(true, predicted) which gives as expected: ...
0
votes
1answer
23 views

log skew normal computation

I want to compute probabilities assuming data have log normal and log skew normal distribution (in R). As I couldn't find any package that directly computes log skew normal (as plnorm does log normal),...
0
votes
0answers
10 views

how to combine Paried t test and multilevel regression in R

I want to compare the difference between two conditions (fed or fasting) for 15 participants, but I have two runs for each participant. I can average the two runs for each participant and do a paired ...
2
votes
0answers
24 views

R - Fitting a Coxian phase-type distribution to data

Using R, I would like to fit a Coxian phase-type distribution to a vector of waiting times ($t_i$) where the $\mu$'s and $\lambda$'s are unknown i.e. I want to find ...
0
votes
1answer
19 views

Percent Censoring in A Cox Regression

How much right-censoring in a PH model is acceptable? For example, my summary of the number of event and censored values is Total: 450 Events: 200 Censored: 250 Percent Censored: 55.6% PH ...
0
votes
0answers
37 views

Fastest algorithm to solve quantile regression with single predictor and no intercept

I was wondering what would be the most efficient algorithm to solve quantile regression with a single predictor and no intercept? I tried a Brent line search, but unfortunately that's no faster than ...
0
votes
0answers
8 views

3d K means cluster plot of multidimensional scaling data [on hold]

I conducted a classic multidimensional scaling analysis (PCoA) of a binary data set with 3 dimensions. I'm attempting to visualize this data set with k means clustering. I've already tested the amount ...
0
votes
0answers
14 views

How to mining association rules in very unbalanced dataset

I have a dataset of a large groceries store with more than 95% of products with very low support. When I generate rules with the apriori algorithm most rules have RHS equal to some product in the high ...
0
votes
0answers
36 views

Scalability of Tsoutlier

I am currently using TSO() in R to find the anomalies. I am doing this for last 3 years daily data. I am getting the output as well with list of anomalies. If i need to repeat on a daily basis with ...
0
votes
0answers
15 views

Get percentagem per item with students grouped by schools in R [on hold]

hope this question is in the right place. My general goal: I have a dataframe of lots of students, their responses for 45 items in a test, and the correct answer also for each of the 45 items. Some ...
0
votes
0answers
7 views

Residual term for calculating F in factorial ANOVA with/without random factor

Manually calculating F in the following ANOVA without a random factor (using lm()) is fairly straightforward; divide the parameter MS by the residuals MS. Am I ...
0
votes
0answers
23 views

eigen function in R

I want to ask about the eigen function of R. I am currently doing a project of NBA team analysis. I am trying to figure out correlation effect of two players lineup ...
0
votes
0answers
11 views

How can I generate a log/log standard curve and extrapolate the concentrations? [on hold]

I carry out Enzyme Linked Immunosorbent Assay (ELISA) experiments, in which a log/log curve fit is required in order to calculate concentration from O.D. I am able to plot my standard curve, however ...
1
vote
1answer
14 views

AIC and BIC come out as NA when running CFA in R

Does anyone have ideas why when running a CFA in R I'm getting most of my fit statistics to calculate, but AIC and BIC are both NA? I load lavaan, SEMplot, SEMtools, and haven; load the file (have ...
0
votes
0answers
12 views

In R, how can i remove a set of rows (for example all data from one participant) based on multiple other column and row criteria? [on hold]

I'd like to know how to filter out a set of rows based on a single value in a dataframe based on several columns. For example if i have a dataset (df) like this: Essentially what I would like to do ...
2
votes
1answer
45 views

linear pattern in residual vs fitted

My question is about addressing linear relationships between model residuals and the response variable. I am using a linear mixed model to model the relationships between two response variables (...
0
votes
0answers
7 views

Understanding the relationship between multiple variables

Having troubles interpreting the results of my pool() function I know what everything means except for the estimate, d and riv columns: ...
0
votes
0answers
13 views

klaR NaiveBayes warnings “Numerical 0 probability for all classes…”

Relatively new to both R and classification, so sorry if this is a dumb question. I'm working on a "first classification" level project using this dataset. My code below for reference. ...
-1
votes
2answers
49 views

can one calculate a p value in a distribution [on hold]

I have an event which happens so many times, I want to know how significantly is 1300$ in comparison to the distribution. which test should I use ?
0
votes
0answers
6 views

Linear discriminant scores using caret

I'm using the caret package in R to undertake an LDA. I'm having problems trying to extract the linear discriminant scores once I've used predict. The model is ... ...
1
vote
0answers
48 views

R - Linear Regression with parameters constraint - contr.sum contrast

I am facing a problem with running a simple OLS regression with two categorical independent variable. I would like to impose that the sum of the coefficients referred to one variable (x in the ...
2
votes
1answer
19 views

How to interpret chart generated by gbm.perf function?

I'm new to GBM.Can you help me to understand the interpretation of gbm.perf function? I used following code in R best.iter = gbm.perf(train, method="cv") & got ...
0
votes
0answers
19 views

How to interpret ARIMA (1,0,0) model? [on hold]

I'm doing time series for my masters thesis, thus I need to interpret som ARIMA models. The data consist of number of recordings per night throughout the summer. I think I'm done with my coding now, ...
0
votes
0answers
12 views

Comparing two NNLS models

I have two NNLS models: y=$\beta_1x_1 + \beta_2x_2$ y=$\beta_1x_1$ I want to compare these two models using ANOVA, but not sure how to apply it. I first tried to fit the models using python (...
0
votes
0answers
21 views

R glmer.nb : how building model with interaction between categorial variables

Before posting this, I made some research but I am very struggle with my modelling approach, so I will try to be clear in what I want to do with my data. I want to apologize if my questions are close ...
0
votes
1answer
15 views

Permutations, shuffling WITHIN but not BETWEEN groups [on hold]

In R, I need to make 100 repeat random permutations of group orders, keeping the composition and sizes of groups the same, but the order within the groups needs to be randomly shuffled (100 times) By ...
0
votes
0answers
14 views

standard error of the reference category of the outcome_ multinomial logistic regression

I am working with a multinational Logistic Regression model where I have a 6-category outcome and have a number of predictors(independent variables). I have set category 1 of the target as the ...
1
vote
1answer
35 views

Multiple regression of variables with different units

I'm new in statistical modelling and using R, so please excuse my mistake for this question. I want to make multiple regression model with these variables: Revenue (in million USD) as dependent ...
0
votes
1answer
23 views

How to handle uncertain counts in poisson test

I am curious about performing poisson test where I have uncertainty about my count. For example, I expect to see 15 bunny rabbits per hike. On a given hike, I positively identify 19 bunny rabbits, and ...
2
votes
0answers
16 views

Using non-parametric transformation (ranking) on variables for factor analysis in R

I have been wrestling with how to simplify a set of mixed variables (some orthogonal, some numeric) some (of both types) of which are significantly skewed. I have run a factor analysis anyway and ...
1
vote
1answer
29 views

Is it correct to use paired t test after 1:2 matching?

Is it correct to use paired t test after 1:2 propensity score matching? How we can do this in R? I found the following link in SPSS (https://www.researchgate.net/post/how_is_paired_t-...
0
votes
0answers
18 views

NA in GLM : Column Length [on hold]

I currently have data with 'NAs' in it and I'm unable to figure out how to make it include the NAs in my glm as opposed to deleting them and thus shortening my column length. This matters because I'm ...
0
votes
2answers
24 views

Using `glm()` in R for correlated count data (data provided)

I have data from one group ($n = 25$) of subjects pre- and post- tested on an $15$-item dichotomously scored test (see below). Given that the data are from the same subjects (i.e., correlated), how ...
0
votes
1answer
21 views

Covariance matrix for the random effect in mixed effects model

According to this post, matrix Omega and sigma are in the results of lmer when we fitting ...
0
votes
0answers
10 views

SMOTE and ROSE methods in CARET (R) do not work for balancing a multi-class dataset

SMOTE and ROSE methods in CARET (R) do not work for balancing a multi-class data set. Specifically, ROSE throws an error telling that it needs two levels. It means that it does not work for multi-...
0
votes
1answer
49 views

Are the same number of trees required to compare Random Forest against GBM?

My training set has 13,737 observations with 53 predictors. I need to compare the accuracy of Random Forest vs. GBM. For Random Forest, I set ntree = 128 [based on ...
0
votes
0answers
25 views

Weighted average by row by feature R [on hold]

I have the following dataset: ...
0
votes
1answer
18 views

R Calculate sample weights based on two socio-demographic variables and aggregate results

After conducting a short survey, I have collected the results in the form of a dataframe. This is a reproducible version of what the actual data frame looks like. ...