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
8 views

Is it possible to compute SIMPROF on lower triangular distance matrix?

I have a lower tri distance matrix, generated from cluster analysis of raster data, from which I want do a a SIMPROF to test the validity of my clusters. I have used packages like clustsig to run the ...
0
votes
0answers
29 views

Find the shape parameter for gamma CDF with other parameters known

Is there a reasonably computationally efficient way to find an approximation of the shape parameter (which will always be positive, but not limited to integers) for a gamma CDF (scale = 1) where the ...
0
votes
0answers
10 views

`rpart` loss matrix and model comparison by AUC

In logistic regression we first build a model and then eventually we can take into account fact that cost of false negative should be lower/higher than cost of false positive. But in the case of ...
1
vote
1answer
34 views

Understanding the statistical scenario using R with basic concepts

I am new to statistics, trying to solve below problem, Two companies selling toothpastes with the lable of 100 grams per tube on the package. We randomly bought eight toothpastes from each company A ...
0
votes
2answers
22 views

Regression/classification models and dummy variables

I want to build regression model (linear and logit) but one of my independent variables is categorical variable with levels "Gym", "School", "Hospital", "Others"...
0
votes
0answers
5 views

How to create data like syntDATA to apply rolwincor_1win (rolling spearman coefficient function) function in R?

I am using (RolWinMulCor library) to perform rolling spearman correlation coefficient on data with three columns. Time, Value_A, Value_B. In the mentioned library, they are using syntData of type ...
0
votes
1answer
21 views

Confidence band around regression line in R

I have a scatter plot that displays the trust in a country's scientists vs trust in scientists globally. based on data I created a scatter plot am trying to understand the confidence band in this ...
5
votes
1answer
206 views

PCA leads to some highly Correlated Principal Components

I have a dataset of 64 highly-correlated variables (with many being interactions of others for example) plus a date and the target variable for a total of 66. I want to derive the principal components ...
1
vote
1answer
23 views

Probabilistic Record Linkage [duplicate]

Record linkage is the task of identifying which records from different data sources refer to the same entities. Without the common identification key among different databases, this task could be ...
0
votes
0answers
10 views

How to select variables for Little´s Test?

Lets assume there are 150 variables in a Dataset. For my analysis I only use around 50 of them. Of those 50 variables, there are 18 Variables which contain missing values. How should I perform the ...
0
votes
1answer
24 views

How to work with continuous overdispered data?

I have troubles with analysis of my data. I analyze cross-sectional data about users activities and spendings from mobile game . I have paying and non-paying users, I need to explain what independent ...
0
votes
0answers
29 views

Should i use ordinal logistic regression or multinomial logistic?

I want to do an analysis on word search performance. Word search performance is my dependent variable. A word puzzle was assigned and the correct number of words is the score, for example 5 correct ...
0
votes
2answers
40 views

How to Forecast Non-Numeric Data

Is it possible to include non-numeric data in logistic regression i.e. education level and occupation? This is a dataset for kaggle credit card approval prediction. I can create IDs to represent the ...
0
votes
1answer
24 views

How to compare different effect sizes (d vs. r)?

My question is whether I can compare two different effect sizes (Cohen's d and r). I have tested the differences between two paired groups regarding different variables. They are paired because they ...
0
votes
0answers
17 views

Comparison of experimental method against gold standard?

I have a method X, assumed to be the gold standard. Then, I have a method Y. The response variable (for example, weight) is a continuous variable. For a sample of n individuals, the response variable ...
0
votes
0answers
15 views

Dependent Variable only fall between 0 and 1 (bimodal with peak 0 and 1). I need to use OLS with Beta transformation model

Dependent Variables only fall between 0 and 1 (bimodal with peak 0 and 1). I need to use OLS with the Beta transformation model. I need to perform OLS regression, for that, I have to do the ...
1
vote
0answers
24 views

Mixed effect modelling

In R, I wish to perform linear mixed effect models by assigning the terms QY, ALOS and expenditure as fixed variables and Month as a random variable. Is this the right format to perform the analysis? (...
0
votes
0answers
7 views

How to find the Chisq values for a two tailed test in R? [duplicate]

How do we find the chisq value for a two tailed test? For left tail we use qchisq(x,df,lower.tail="True") For right tail we use qchisq(x,df,lower.tail="False") What about two ...
0
votes
0answers
22 views

What is the shape of the distribution MCMC is sampling from in a simple linear regression?

I'm struggling to understand the shape of the space a sampler works with in a Bayesian framework. If I run a simple linear regression I can see that the priors are: a flat prior on the slope a ...
0
votes
0answers
13 views

Testing if groups are statistically different from 0.5 in a binomial GLMM

I have a dataset where I have a binomial (bernoulli - either 1 or 0) response variable, a single fixed factor containing 3 different groups (group1,group2,group3) and a random factor specifying ...
1
vote
0answers
24 views

What is the sampling distributions underlying a moderated (interaction) effect?

I'm trying to derive the underlying sampling distribution of moderated effects (product of two continuous random variables), to compute its statistical power. At this point, I'm mostly interested in ...
0
votes
0answers
10 views

Comparing segregation of populations

I am trying to work through some data and statistical analysis a predecessor has already done. I have two populations of n individuals that were evaluated multiple times in multiple years. So every ...
0
votes
0answers
13 views

How do I structure my categorical variable data for a Multinomial Logistic Regression model in R? (Using the multinom() function)

I am trying to properly run a multinom() model, however I am unsure as to how I should score my categorical variables. I read an article on RPubs under the Multinomial Logistic Regression which left ...
0
votes
0answers
14 views

How do you differentiate between time-varying covariate versus nontime-varying covariate in growth mixture models/latent class growth analysis in r?

I am attempting to run a LCGA / GMM analysis in R but I am not sure how to control for time-varying covariates. I understand that R only has the capability to do the 1-step approach. Does this mean ...
0
votes
1answer
12 views

How to compare hazard ratios between two levels of a categorical variable in Contrast from RMS package

I am performing an interaction spline analysis for age (continuous) and Quartiles of ancestry (categorical). My outcome variable is a survival outcome (incident stroke). The focus is to compare Q4 to ...
1
vote
0answers
17 views

How to empirically check properties of bootstrapped sample mean

Problem Setting: Consider the situation that we observe $X = (x_1, x_2,...,x_N)$ i.i.d from the distribution with mean $\mu$ and variance $\sigma^2$. We denote the sample mean as $\bar{x}$ and let $\...
1
vote
1answer
29 views

Generating random variables from a given distribution function using inversion sampling

Given this distribution function $f(x)$ : $$ f\left(x\right)=\left\{\begin{matrix}x+1,-1\le x\le0\\1-x,0<x\le1\\\end{matrix}\right. $$ Generate random variables using Inverse sampling method in R: ...
0
votes
0answers
19 views

Oaxaca-Blinder decomposition and RIF Regressions in R

I am studying the effects of QE on income inequality in the US. I am attempting to build upon the paper authored by Montecino and Epstein (2015), in which the authors study the same topic. My ...
0
votes
0answers
17 views

GRS test sharpe ratio and slope efficient frontier

I am investigating a multifactor asset pricing model and use time-series regressions on 25 portfolios sorted on size and BM. Therefore, I am implementing a GRS-test using the GRS.test package in R. ...
1
vote
0answers
16 views

Understanding partial dependence plot from XGBoost in R

I have developed an xgboost model in R using the package 'xgboost', with a binary outcome being predicted. I'm looking at a partial dependence plot of one of the important features, and I'm confused ...
0
votes
2answers
30 views

Why is it a variable that was created with dplyr is not showing in the new dataframe in R? [closed]

I am analyzing a Demographic and Health Survey data set. I am in the phase of creating variables. I created a variable using dplyr and mutate, but when I use the function exist to find out whether it ...
0
votes
0answers
31 views

Is an ANOVA appropriate?

I am trying to describe a data set measuring toxicity by group with and without a treatment. The data was collected in pairs, such that the researcher would take the difference in toxicity between a ...
1
vote
0answers
16 views

How do I interpret the output of a fuzzy regression discontinuity with rdd_gen_reg in R's rddtools?

I'm running a fuzzy regression discontinuity in R. I'm trying to understand the interpretation of each coefficient in the regression output. I know that x is the effect of the running variable on the ...
0
votes
0answers
20 views

Bayesian approach to coefficient's with “known” standard errors

So I'm working with a data set that includes estimates at a certain geographic level that I will refer to as stratas. Because of how the sample was designed, the stratas don't have equal numbers of ...
3
votes
1answer
32 views

GLM Poisson Regression with Overdispersion

I use R for a poisson regression (GLM) to test for a difference in the number of years of schooling based on race (6 categories) and religion (3 categories), see structure of dataset and output below. ...
2
votes
1answer
35 views

Determining the winner model from ROC curve

I have a ROC curve for a specific hyperparameter tuning setting for a decision tree. The candidate values for which I plot are 0.1, 0.01, 0.001, 0.0001. I want to determine (visually) which model has ...
1
vote
0answers
21 views

Differing posterior predictive checks for logistic binomial model with and without addition-terms

[apologies for cross posting] I’m fitting a logistic binomial model where the response variable is the sum of how many times a target picture was looked at during a certain time period out of how many ...
0
votes
0answers
8 views

Can I use a 2 step model for my dataset with lots of zeros when the corresponding anova model has nested random effects and interactions

I have a lot of data on pig behaviour. I'm trying to analyse the percentage of time (in 4 observation periods of 2 hours) that the pigs carried out various behaviors. Here is the R code for the ANOVA ...
0
votes
1answer
48 views

Why does my logistic regression model fit probabilities numerically 0 or 1? [duplicate]

When I fit a logistic regression model with my data set, I get the warning "glm.fit: fitted probabilities numerically 0 or 1 occurred", and the result for one of my dummy coefficients $x$ is ...
0
votes
0answers
12 views

Effect size using nparLD library RStudio

I would like to calculate the size of the effects using RStudio for writing an article. I have longitudinal data taken in 4 time points: baseline, day 20, day 50 and recovery (one month after) in a ...
0
votes
0answers
28 views

Which variables should i convert for logistic regression?

I have the following variables: ...
1
vote
1answer
47 views

SEM : WLSMV or WLS?

I am conducting a SEM in R using lavaan and I am a bit lost regarding which estimator I should use. I have a model like the following : The variables a,b,c,h are binary categorical and the rest are ...
1
vote
3answers
71 views

Is it possible to tweak the statistical significance of variables in a regression?

my regression gives me a p-value of 0.03039 for my coefficient (beta) and 0.22488 for my intercept (alpha). I am mostly interested in my alpha and want to improve its statistical significance. Is this ...
0
votes
0answers
12 views

Decision Tree model using Rpart

I am trying to create a node-link diagram (decision tree) by using parsnip and tidymodels. What I am performing is building a ...
3
votes
1answer
68 views

Interpreting QQplot

This is a question about how to understand qqplot results. To present the problem, I have a set of 54 measurements from archaeological objects. I calculated both kurtosis and skewness with the Moments ...
4
votes
1answer
47 views

Is this linear model the right choice?

My data is like the below table: ...
0
votes
1answer
19 views

Interpreting categorical variable if reference class includes several levels

I have a dataset with several categorical variables. I have been running some regressions and used dummy coding for these categorical variables. The problem is that some specifications lead to perfect ...
0
votes
0answers
11 views

Why do I get different values for MCSE and SD while I have good estimates in a simulation?

I am a newbie to this concept so I am not sure what exactly is causing this: I am doing a simulation study: 300 samples each which the size of 13000 to compare two estimators for the mean of the ...
2
votes
1answer
47 views

How to forecast from GARCH-copula model?

I am reading to understand how to forecasting time-series data from the GARCH-copula model. I am looking forward to understanding the steps. From my understanding, we should follow the following steps:...
0
votes
0answers
6 views

How to correctly merge two files and count values before Fisher's test in R? [migrated]

I am very new to R, so I apologise if this looks simple to someone. I try to to join two files and then perform a one-sided Fisher's exact test to determine if there is a greater burden of qualifying ...

1
3 4
5
6 7
510