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

How to do moderated mediation analysis with linear mixed model with nested random effect?

I want to build a model like this. All variables are continuous variables. Each subject was measured for many times across days, so this should be done with a linear mixed model I guess. What's more, ...
Eve's user avatar
  • 51
1 vote
0 answers
27 views

How to test specific contrasts about levels of categorical variables through nested models? [closed]

This is not about obtaining any dataset. I HAVE the dataset. This is not about debugging code, this is about EXPLAINING the way to obtain statistical relationship between the nested models (LRT ANOVA) ...
AshanaShiiii's user avatar
2 votes
0 answers
19 views

How to fit a GLMM with multiple levels of nesting

I have some data I am struggling to process at the moment. I have landed on using generalized linear mixed models (GLMMs), but I am having a very hard time wrapping my head around it. I have a large ...
Joseph's user avatar
  • 21
7 votes
3 answers
282 views

Different estimates of Least Squares and Maximum Likelihood Estimates under non-normality

It is said that Least Squares estimates would differ from Maximum Likelihood estimates if the underlying data were non-normal. This should be the reason why LS estimates can be used in linear ...
Anti's user avatar
  • 209
0 votes
0 answers
21 views

How to implement the proposal distribution in metrop() function in R from mcmc library [closed]

I am trying to apply Metropolis Hastings to coefficients of logistic regression. I applied it manually with a proposal distribution: normal distribution with mean of the previous iteration of ...
learn_to_code1's user avatar
0 votes
0 answers
39 views

multiple testing and p-hacking when choosing from many models

I'm trying to train a random forest model with a particle swarm optimization algorithm because my target function is not smooth and unknown to me, that is, in essence, this is search and training at ...
mr.T's user avatar
  • 259
0 votes
0 answers
7 views

Different output in variable importance in decision tree R [closed]

Im doing tree model in R, when trying to get variable imporance in different ways i get different outputs: first way: ...
Eyal Katz's user avatar
0 votes
0 answers
6 views

Return period of vine copula

In the formula for "OR" joint return period of 3-dimensional copula modeling, we need to find C(u,v,w) but when we model using vine, we are only able to obtain the copula C(uv|w). So, how to ...
user387921's user avatar
0 votes
0 answers
22 views

phacking R package. Is it possible to estimate the degree of overtraining? [closed]

There is a package called phacking that offers tools to demonstrate p-hacking, a practice in which researchers abuse data analysis to produce meaningful p-values. It includes functions for performing ...
mr.T's user avatar
  • 259
0 votes
0 answers
19 views

System GMM yields identical results for any weighting matrix

I am estimating a system of seemingly unrelated regressions (SUR) in R. Each of the equations has one unique regressor and one common regressor. I am using ...
Richard Hardy's user avatar
0 votes
0 answers
38 views

How to resolve the residual versus predicted quantile devation (Dharma plot)?

I have been trying to perform beta regression modeling with random effects. I have sex ratio (0.561, 0.765 etc) as the response variable, and climatic variables + years (1970-2021) as predictor ...
Rahul's user avatar
  • 3
0 votes
0 answers
9 views

How do I model the volatility of financial returns with an EGARCH model based on the EGB2 distribution in R?

Since this is super specific, the EGB2-distribution is not built in to the "rugarch"-package in R and I can not seem to figure out how to do this. I have formulas and equations for the PDF ...
user avatar
0 votes
0 answers
29 views

Predict COVID spread using latitude and longitude and time

I have a data that has latitude and longitude of individuals and the timestamp of geographical locations. I want to predict the spread of COVID using R using latitude/longitude and the time as well. I ...
William's user avatar
  • 131
0 votes
0 answers
20 views

Simulating Power Analysis for Mixed Models (lme4 and simr)

I would like to calculate an a-priori power analysis for a within-groups study with the following design: participant_id condition (within groups - A, B) covariate (scale 1-7) questionnaire items (...
becbot's user avatar
  • 111
0 votes
0 answers
13 views

How to specify a logistic regression with treatment happening in different times per user?

I have a dataset with a time span from 2017 to 2021. The observations contain reviews from a certain platform. I want to test the effects of Elite status changes (so from elite to non-elite and non-...
user avatar
1 vote
1 answer
35 views

Why does `systemfit` yield different results for OLS and WLS under cross-equation restrictions?

I am following up on the question "Why does systemfit yield identical results for OLS and WLS?". It deals with estimating a system of linear equations ...
Richard Hardy's user avatar
3 votes
2 answers
203 views

What causes the parameter phi (precision) to be very small in beta regression (by betareg in R)?

I tried to do a beta regression for a variable affected by age and intimacy, but it did not work well. The value of phi (precision) estimated by maximum likelihood method is very small, and when I ...
TomoChang's user avatar
1 vote
0 answers
31 views

Statistical test to check if two samples come from the same DISCRETE distribution

I am computing hourly backward wind trajectories for the 1985-2023 period, and obtaining all the pixels that are crossed by these trajectories. I have the pixel ID frequencies for these trajectories - ...
jparbache's user avatar
0 votes
0 answers
10 views

Struggling with normalization/Standardisation for machine learning dataset [duplicate]

Sorry for what is probably a very obvious/rookie question. I'm currently doing a data science module for my degree and making very slow progress with the work. The case study i'm doing is around HR ...
Alex Ferry's user avatar
0 votes
0 answers
16 views

Is it possible to do a PGLS analysis if some species on the tree appear more than once in the dataset?

I am trying to conduct a PGLS regression on the fidelity and relative size of flies, however some of the species of flies appear in the dataset more than once (their relative size is compared to ...
user avatar
3 votes
1 answer
43 views

How to simulate non-standardized artificial data for logistic regression?

I would like to simulate data for a logistic regression with the predictor variables on their original scale. There are, of course, a litany of similar previous questions (e.g., here, here, and here). ...
the-mad-statter's user avatar
0 votes
0 answers
5 views

mice: Default ridge parameter

Some methods in mice like pmm and norm apply a default ridge parameter of 1e-5 when the underlying data is nearly multi-collinear. In van Buuren's great book ...
jerome's user avatar
  • 21
1 vote
2 answers
153 views
+50

When should I standardize, before or after a regression?

I have a panel dataset and my dependent variable is the logit-transformed share of farm workers on long-term contracts. I am particularly interested in the effects of two variables, pastoral focus in ...
Mikhail's user avatar
  • 95
0 votes
0 answers
14 views

In R: How can I count the share of occurrences of one variable within another variable? [closed]

This is probably a very simple answer but I just can't seem to figure it out! I am working in R. If I have a data set that includes ratings from a feeling thermometer (all entries are numerical 0-100) ...
Samantha's user avatar
1 vote
0 answers
17 views

SUR estimated via `systemfit` vs `sysGmm`: different standard errors

I am estimating a system of seemingly unrelated regressions (SUR) in R. Each of the equations has one unique regressor and one common regressor. I have two alternative implementations: one via ...
Richard Hardy's user avatar
1 vote
2 answers
59 views

Why does `systemfit` yield identical results for OLS and WLS?

I am estimating a system of seemingly unrelated regressions (SUR) using the systemfit package in R. Each of the equations has one unique regressor and one common ...
Richard Hardy's user avatar
2 votes
0 answers
34 views

Dealing with Underdispersion in Poisson Regression (GLM) with count data as a response variable

Related to glm() in R, I am working with count data (number of mammal species on islands) and following statistical theory, I have fitted a ...
ykk's user avatar
  • 21
1 vote
2 answers
26 views

is it possilbe to run AR(1) model in R with ar is bigger than 1 [closed]

is it possilbe to run AR(1) model in R when ar(which is pie in AR model) is bigger than 1 i know that arima.sim can run AR(1) model with following codes ...
Hobal's user avatar
  • 13
0 votes
1 answer
59 views

Can Phi coefficient for intercept be negative?

I am working on beta regression model with two grouping variables (farm and years). Climatic variables are my predictors. Response variable is male proportion. I standardized all variables prior to ...
Rahul's user avatar
  • 3
0 votes
1 answer
36 views

Variable Importance Plots - Logistic Regression [closed]

For generating variable importance plots in R, for logistic regression, can you use the function varImp directly to generate importance? Is it required that you do ...
cake2244's user avatar
1 vote
1 answer
13 views

What information is the "intercept" presenting in the IRR column when using parameters package for glmer

I am currently using the parameters plug in to convert glmer model results to Incidence Rate Ratios/IRR. The problem is that I am very confused about the results parameters presents in regards to the ...
user avatar
0 votes
0 answers
23 views

Addressing Heteroscedasticity in Mixed Effects Models with glmmTMB and DHARMa in R [duplicate]

I am analyzing ecological data in R, where I aim to understand the impact of urbanization on species trends. My response variable is the coefficient of species trends (estimate), and my main predictor ...
Pau Colom Montojo's user avatar
2 votes
0 answers
52 views

Addressing Heteroscedasticity in Mixed Effects Models with glmmTMB and DHARMa in R

I am analyzing ecological data in R, where I aim to understand the impact of urbanization on species trends. My response variable is the coefficient of species trends (...
Pau Colom Montojo's user avatar
0 votes
0 answers
15 views

Linear mixed models with and without interactions

Here is the context: I asked two types of questions 8 times (8 "sessions" with 2 questions, each question has a "number" i.e. whether it is the first or second question asked, and ...
statuser's user avatar
1 vote
0 answers
52 views

What are the assumptions of beta-binomial models, and how do I test for them in r?

I want to model the effects of dispersal distance (disp) and reproductive rate (rep) on colonization rate, quantified as the ...
JessKL's user avatar
  • 11
0 votes
0 answers
8 views

Sparse PCA component weights / coefficients of linear combination to describe PC

From my (limited) understanding of a sparse PCA, by allowing certain loadings to be zero, you are better able to approximate which linear combinations of loadings correlate with each principal ...
Rover Eye's user avatar
  • 587
1 vote
1 answer
25 views

How to interpret a regression table with logged DVs?

I'm writing a research paper and am using R for my quantitative analysis. I'm using OLS regression and have needed to perform a log transformation on my dependent variables for linearity however I don'...
Bella's user avatar
  • 11
0 votes
1 answer
44 views

How do I calculate the power and effect size for the Wald-type statistic of the RM-function from the MANOVA.RM package in R?

I have calculated the RM-function from the MANOVA.RM package in R and now need to calculate the statistical power of the test and the effect size for its Wald-type-statistic, including the ...
Luise's user avatar
  • 3
2 votes
0 answers
56 views

SUR estimated by OLS: restricted model has higher likelihood

I have three versions of a system of linear regression models: M, M0 and M00. I think each ...
Richard Hardy's user avatar
0 votes
0 answers
35 views

Avoid singular fits in mixed models in R with blme - checking layman's priors

While fitting linear mixed models, I would like to avoid zero random-effects (ranef(model)) and cluster-level SD estimates (...
Imsa's user avatar
  • 43
0 votes
0 answers
22 views

How to make the profile likelihood model for estimation?

I tried to make the age estimation model using the chemical compound results from The soil. Initially, I used the multivariable regression model. However, the reviewer highly recommend using the ...
user21268575's user avatar
2 votes
2 answers
253 views

regression paradox

I have to do a binary logistic regression with two dichotomous independent variables. I found myself faced with a paradox that I don't know how to handle. In the complete database I have 21 (5.6%) ...
ArTu's user avatar
  • 213
1 vote
2 answers
36 views

Determine p-value for sensitivity between two algorithms using R

In R, I have a dataframe that looks like this (2000+ rows): Sample AlgoA AlgoB A FP TP B TN TN C TP TP D FN TP E FP FP F TN TN G TP TP The ...
Blaze9's user avatar
  • 21
1 vote
0 answers
16 views

Determine p-value for specificity between two algorithms using R [duplicate]

In R, I have a dataframe that has looks like this (2000+ rows): Sample AlgoA AlgoB A FP TP B TN TN C TP TP D FN TP E FP FP F TN TN G TP TP ...
Blaze9's user avatar
  • 21
0 votes
0 answers
21 views

Extreme Value Analysis on climate data + interpretation [closed]

My knowledge is limited on Extreme Value Analysis. I would like to understand the key differences between these two functions and what they are doing exactly. My first guess is just an aggregation ...
herakles_1950's user avatar
3 votes
1 answer
20 views

Can GAM with Tweedie distribution be used for a binary response?

I am trying species distribution models with GAM. The data set is the presence/absence of a species and environment variables in each grid. In the paper of Virgili et al. (2018), the authors suggested ...
Terpsiphone's user avatar
0 votes
1 answer
22 views

How to Run Regression with Replication in R

Looking to see if anyone knows how to run a regression analysis with replication in R. I have a data set with multiple values of Y for each value of X. I could take the mean of the Y values, but that ...
user avatar
1 vote
1 answer
20 views

How to simulate correlated data with specified min and max and cov and mean in R

I want to simulate data with fixed mean and covariance matrix as multivariable distribution in which generated data must be in a range [floor , ceiling]. Using MASS::mvrnorm I can not specify the ...
Sina Asadiyan's user avatar
0 votes
1 answer
42 views

What can I do about model tuning parameter instability?

I am trying to determine the importance of watershed characteristics on the slope of the concentration-discharge relationship for several rivers. I am using partial least squares regression (plsr) ...
Ryan's user avatar
  • 1
0 votes
0 answers
24 views

In a mixed effects model, can leaving out the intercept-slope correlation parameter inflate type I error?

I am considering leaving out the intercept-slope correlation parameter in a mixed effects model to avoid convergence issues (i.e., in nlme::lme, ...
Evan's user avatar
  • 205

1
2 3 4 5
596