Stack Exchange Network

Stack Exchange network consists of 174 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`.

3
votes
0answers
29 views

How to combine multiple p-values into one? [closed]

I have the data of 841 genes along with the p-values which represents the association of that gene in a particular tissue (Aorta in this case) with some diseased phenotype. I want to combine the p-...
-1
votes
0answers
13 views

Bayesian approach for exponential and Cox proportional hazard model in R

I have difficulty understanding and applying the Bayesian approach to survival analysis. I assume that data follow exponential life time likelihood and that failure rate lambda can be expressed in ...
0
votes
0answers
12 views

R: Any benefits of converting factor column to scaled double? [duplicate]

When building a (generalized) linear model, is there any benefit of converting a factor column (i.e. True/False) to a scaled double vector? With booleans, say: ...
2
votes
1answer
28 views

How do I perform leave one out cross validation with boosting?

I'm working with the Anderson Iris data set and it is too small To split into a test and training set.I use boosting To make a classifier For determining the species Of flower Based on Variables in ...
0
votes
0answers
16 views

Using Caret is there a way to explicityly state what the true class is in binary classification?

I'm using caret + XGBoost to make binary predictions on a dataset. The data are very imbalanced so I'm using prAUC metric. My results using 5 fold cross validation are a prAUC of 0.99+ which is not ...
0
votes
0answers
17 views

Simplifying R code when fitting data (for loops) [migrated]

I have working code to accomplish my goal, but as you will see it is not very elegant. I've tried writing it with for loops but my coding knowledge is relatively basic. Could some generous person help ...
1
vote
1answer
29 views

Bayes inference: hypothesis testing on the average parameter

Bayesian inference field: given a dataset, if I assume a normal a priori distribution on the average parameter with zero mean and a given variance, those hypothesis tests can be carried out on the ...
0
votes
1answer
59 views

Confidence interval in R lm function with factors values

Does lm R function handle factors value 'correctly' when computing confidence interval ? I read that confidence interval formula are different in case of discrete or continuous variable. Thanks. ...
0
votes
0answers
27 views

Mixed Design ANOVA on MICE imputed data in R

I have a question about performing a Mixed Design ANOVA in R after multiple imputation using MICE. My data is as follows (R code): ...
0
votes
1answer
38 views

Preparing data for cross-correlation time series

I have several data sets with air quality measurements for 20 locations. The measurements were done per second over a period of two weeks, 5 locations per period (because there were only 5 instruments)...
0
votes
0answers
21 views

Optimization Technique Needed

I am trying to figure out an optimization technique to below: For context, everything to the left of "New Upcoming Games" is historical data. In my actual dataset I have about 200-300 rows that will ...
0
votes
0answers
15 views

Questions about conducting Mixed-Design ANOVA in R

I have a dataset that includes one IV with 3 levels (group 1, group 2, and group 3) and a repeated DV (pre test score and post test score). I am using R, but I'm unsure what codes I should use to test ...
0
votes
0answers
43 views

How can I cross-validate a simple binary classifier?

I have a dataset of 30 observations of two variables (one is a class and it's binary, the other is a percentage and it's continuous). My ultimate goal is to build a classifier that is able to predict ...
0
votes
0answers
22 views

Will Boruta Analysis work on unbalanced dataset? [closed]

I have over 50 variables and would liked to use Boruta Algorithm to perform feature selection based on my target variable (which is binary). My dataset is unablanced. My results with the first run ...
2
votes
1answer
34 views

Weight optimization in order to maximize correlation [R]

I'm researching a way to speed up a problem I already have in Excel's Solver. I wanna know if my approach is correct (I doubt it tbh) and if there're better alternatives. I have a matrix of scores I ...
2
votes
1answer
77 views

One sided test $H_0:\mu=0$ or $H_0:\mu\leq 0$? [duplicate]

I want to test $$H_0: \mu \leq 0 \,\,\,\,\,\, vs \,\,\,\,\,\, H_1: \mu > 0.$$ I am using a t test, so the statistic $T$ has $\nu$ degrees of freedom which depend on the sample size. What is ...
0
votes
0answers
98 views

lme4 singular fit non randomized design

I am analyzing a dataset with lme4. I am investigating the effects on vine yield of 5 different "Treat". We are working on-farm and we were not offered the possibility of a randomized design. So we ...
0
votes
0answers
34 views

Testing equality of two coefficients of two separate regressions in R [duplicate]

I run the following regressions: Y_1 ~ c_1 + b_1*X Y_2 ~ c_2 + b_2*X and I get two estimates for b_1 and b_2. What is the appropiate statistic to test if ...
2
votes
1answer
49 views

Finding expression of $n$-th derivative, when $n$ is large

For completeness, assume $C$ is an Archimedean copula with some generator function $\varphi$, which is usually assumed to have nice properties. It is known that $$ C(u_1, u_2, \ldots, u_n)=\varphi^{-1}...
0
votes
1answer
28 views

How to delete rows that are duplicate but for one variable while keeping the highest value row? [closed]

I have a large dataset with 4 variables. There are some rows that are duplicate but for the values on the last variable: I only want to extract the one row with the highest value on the last "Total" ...
1
vote
1answer
30 views

Choosing model for feature selection on categorial data

I have a dataset composed 30 features and 1 response. My response is 0 or 1 and, all of my features composed three status includes = -1,0,1. I wanted to do features selections in R, firstly I want to ...
1
vote
1answer
22 views

Confusion Matrix for multiclass classification in R

I built a multiclass (11 classes) SVM model for text classification having generated a bigram from the given text. I am trying to build a confusion matrix. The output is something like this: ...
0
votes
1answer
45 views

Why does weighted bootstrap have awful coverage even in toy example?

I'm interested in using the weighted bootstrap to correct for selection bias with a known form. I simulated a very simple example where the underlying data, $X$, are $N(0,1)$ and we are calculating a ...
2
votes
1answer
34 views

Comparing Sex Ratios Between Locations

Feel like this should be a pretty simple test to run but am having a major brain fart courtesy of having the holiday off. I have a data set that looks like this: ...
0
votes
0answers
8 views

How to calculate allocation imbalance in stratified randomization

I have carried out stratified randomization using 2,3 and 4 prognostic factors in r. How will I compute allocation imbalance in each of the above allocation?
0
votes
0answers
33 views

ARIMA lag order selection by auto.arima

I use the funtion auto.arima in my dataset auto.arima(Clean_Ts_Dados,trace = T, stepwise = F, approximation = F) and got ...
1
vote
1answer
45 views

How can I plot relationship between two variables with the constraint of initiating the S-shaped curve from (0,0) as depicted in the example below?

I don't want to run logistic regression or any such regression model. I have 8 to 10 pairs of data points and want to analyze the logistic growth model by fitting any function-generating S-shaped ...
1
vote
1answer
43 views

changing the coding system from helmert coding to difference coding changes regression results?

EDIT: I think I have mistaken the names of the coding systems, so I changed it (in bold). The content has not changed at all, though, so I would still appreciate any answer. END EDIT I'm running ...
0
votes
0answers
32 views

VAR with stationary and non-stationary in R

I'm working on using Granger causality of some variables and I have 4 stationary time series (X1, X2, X3, X4) and one that is not (X5). I've seen here that If (A) then first-difference each of the ...
0
votes
1answer
20 views

How to evaluate neural network regression model

I have some data with 2963 observations and 7 variables. I want to use regression and train this data using neural network then evaluate the regression model. I've tried splitting the data into ...
1
vote
0answers
10 views

“if else” statement repeating first value in statement instead of calculating for each [migrated]

I would like to create a new column in a Tibble which determines the contribution from each mobility score to an index score. I used the following code: ...
3
votes
2answers
111 views

Simulating the Posterior Density of a Transformed Parameters

I am reviewing an example (p. 180-181, Example 11.3 and 11.4) from All of Statistics by Larry Wasserman. The example intends to illustrate that the posterior can be found analytically and can be ...
2
votes
2answers
224 views

How to interpret a mosaic plot in R?

The mosaic plot shown bellow is the product of this code ...
1
vote
0answers
48 views

How do I get an odds ratio with McNemar's test?

I have pre and post test data evaluating the effectiveness of a lesson about how to help friends who are being bullied. I am trying to see if more students know how to help a friend being bullied ...
0
votes
0answers
37 views

Is my (repeated-measures) multilevel model correctly specified in R?

Objective: I would like to make sure I specified my multilevel model correctly in R using nlme package. Background: I have a ...
0
votes
0answers
7 views

Extract found word and 20 Words before and after it [migrated]

I am using stringr to scan through a very long text. If the word is found. I want to extract not only the word, but some context, lets say twenty words before and after the word has been detected. So ...
0
votes
0answers
38 views

Calculate Power of Bootstrap Test for Equality of Means

I am new to statistical resampling techniques. Here is a problem I am having difficulty with: I am given two independent Gaussian samples of size $30$ with equal underlying parameters ($mean = 15$ and ...
2
votes
0answers
35 views

How should I interpret the coefficient in the output of this Logistic Regression? [duplicate]

This is a binary model that my colleagues and I developed that regards a connection between the satisfaction with air (dependent variable) and overall satisfaction with public transport (covariate). I ...
1
vote
1answer
31 views

Mixed model ANOVA - multiple measurements

I am dealing with multiple measurements of the same variable in different subject in three geographical areas. Unfortunately, the number of measurements of the variable differs among subjects. My data ...
1
vote
0answers
11 views

Efficiently producing Partial Residual Plots in R [migrated]

I have a large glm (4Gb in size) for which I would like to display the partial residual plots using crPlots(myGLM) Currently RStudio hangs on displaying the first plot. The machine I'm using is ...
0
votes
1answer
43 views

Variable Selection for Negative Binomial Regression

First off I apologize, that I cannot share the code or details about the variables for this project. I am new to statistics and am working on a project using count data. I want to make sure I am going ...
0
votes
0answers
6 views

Keep less recent duplicate row in R [migrated]

So, I have a dataset with bill numbers, day, month, year, and aggregate value. There are a bunch of bull number duplicates, and I want to keep the first ones. If there is a duplicate with the same day,...
0
votes
1answer
51 views

How to interpret the results from a binary model done in R? [duplicate]

This is a binary model that my colleagues and I developed that regards a connection between the distance (dependent variable) and overall satisfaction with public transport (covariate). I don't know ...
2
votes
1answer
64 views

Calculating confidence interval for ratio of sums

I have a problem where I need to calculate a confidence interval for a ratio of two sums. I have code below which calculates this stat using a bootstrapping method, but I would much prefer a closed ...
0
votes
0answers
18 views

Seasonality detection based on ACF

Browsing the M4 time series competition repository I saw the following piece of code to determine whether a time series is seasonal or not using the ACF, where "ppy" is the frequency of the time ...
1
vote
1answer
32 views

Clarification: text2vec, embeddings, doc2vec

I am trying to grasp the concept of word / document embeddings; I am using R as coding language, and I try to understand the text2vec package. Are the following statements about text2vec correct? ...
0
votes
0answers
16 views

Why is Stata smothed hazard estimate pruned to interval?

I have played through this R example to calculate hazard estimates. I chased the whole thing through Stata and obtained a different graph, though. R graph: Stata graph: What's the rationale ...
1
vote
0answers
33 views

How are confidence intervals calculated for lm in R using predict?

Here, a simple linear model, given x = 98, yields a predicted value of 24.47 with 95% confidence interval [23.97, 24.96]. ...
0
votes
0answers
25 views

Poisson log linear Regression: using either R or python

I was hoping someone can help me with this problem. I posted a similar question earlier but it's not the same. I have the following: A 2x2 matrix of structural connectivity values between brain ...
1
vote
3answers
55 views

How to determine which distribution fits my data set?

I have this data set which I am trying to find which distribution my data set can be accurately represented by using r. I performed the Shapiro-Wilk test and found that my data does not come from a ...