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`.
30,114
questions
0
votes
0
answers
7
views
Comparing nested models for fixed main effect when there are interactions
I have a linear mixed model, which uses a multiply imputed dataset. I saw that LRT could be used to assess Fixed effect significance in linear mixed model. I used ...
0
votes
0
answers
5
views
Improving glmm accuracy - what can I do here?
I'm working on a model in R but my validation suggests it's breaking some assumptions - non-normal residuals and heteroscendasticity. My dependent variable is highly skewed, and originally bounded (...
2
votes
1
answer
13
views
Verifying consistency of heteroscedasticity and autocorrelation robust SEs with a Monte Carlo Experiment
I'm trying to demonstrate the consistency of the default HAC standard errors given in R's sandwich package via a Monte Carlo experiment. I'm using a linear model ...
1
vote
0
answers
7
views
anova.mitml.results giving high df2 when comparing nested models
I'm comparing nested models using anova.mitml.results to test my fixed effects.
I have 25 imputed datasets, 231 participants per time measure x 3 time measures. I'm ...
0
votes
0
answers
17
views
Transferring a regression with ARIMA error model from R to Excel (formula help)
I'm trying to translate an ARIMA model into an Excel spreadsheet for calculations for something I'm studying.
The model is a ARIMA(4,1,0) that I used the ...
0
votes
0
answers
11
views
predicting with the glmer function in r (binomial data) [closed]
I am trying to use the glmer function to predict on nested data. I have longitudinal data from multiple devices in a field which are either control or in an exclosure. I have created my validation ...
1
vote
1
answer
36
views
Inflated fixed effects in mixed-effects logistic regression model
I have a dataset with multiple observations per ID and a binary outcome. I am trying to fit a mixed-effects logistic regression, however, the fixed effect estimate of the intercept is extremely large ...
-1
votes
0
answers
9
views
R package documentation namespace and description [closed]
Good morning,
I am writing an R package in a first draft I have imported the function corrplot from the package corrplot adding it also to the NAMESPACE (using roxygen2). That is:
...
0
votes
0
answers
10
views
Microsynth "Feasible model" Example from Publication Returns Infeasible Models in My R Installation [closed]
I'm attempting to rerun the example provided in the publication of the microsynth package, which estimates the effect of an intervention (DMI) on four crime outcomes (i_felony, i_misdemea, i_drugs, ...
0
votes
0
answers
22
views
Why would the "dirichletprocess" package in R return the number of clusters of the last MCMC iteration?
I've been working with the "dirichletprocess" package in R, specifically trying to recreate the example shown in the vignette where they cluster the eruptions in the Old Faithful dataset ...
0
votes
0
answers
12
views
+50
What is backfilling when generating an AR sequence?
I am reading this paper: Extracting cycles from Nonstationary Data
I wish to recreate the Monte Carlo simulation in this paper.
I have a query prior to doing this.
On page 8, there is footnote 9, ...
0
votes
1
answer
48
views
Probability Problem from The Game "Dice & Fold"
I'm wondering if someone can give the analytical solution to this problem:
You start with a single die.
You roll the die, if the result is <5 then you lost the die while if
the result is >= 5 ...
0
votes
0
answers
9
views
Transform ID variable / change values [closed]
I am working with a dataframe in R Studio and try to prepare data for ML analysis. I have a dataset with a complicated ID variable looking like "ffcaadc19654eb1b6d1000". The IDs have ...
4
votes
2
answers
117
views
Is response variable/dependent variable data required for simr simulation?
I'm using simr for power analysis of a linear mixed effects model. Most examples I've seen use data from pilot studies for simulation, but I don't have any data yet. My questions are:
Is data for the ...
1
vote
0
answers
14
views
Plotting effects in Dirichlet regression
I performed different regression analyses, including Dirichlet regression, on compositional data.
I want to create a plot similar to the one obtained when you use the package ...
0
votes
0
answers
10
views
Unable to plot ggsurvplot curves with stratified variables [closed]
I'm trying to create a ggsurvplot curve stratified with different type of variables, but I keep getting errors.
This is the code:
...
0
votes
0
answers
15
views
Drop out data due to death or hospitalization in WGEE
I have an RCT dataset of people aged 60 years or older who have been hospitalised for a cardiovascular event and discharged from hospital just prior to entering the study. Participants are randomly ...
0
votes
0
answers
16
views
Interpretation of coxPH model with and without splines for non-linearity
I am fitting Cox Proportional Hazard Models to investigate the impact of external, military support (my covariate) on the "risk" of a peace agreement (my event of interest) after civil war.
...
2
votes
0
answers
29
views
How do I best fit my linear mixed effect model with lmer() from the "lme4" R-package?
So, I'm pretty new to R and modeling with lmer from the "lme4" package. I would love some help on how to fit my model to answer my research question; if different grab types are comparable, ...
0
votes
0
answers
16
views
HoltWinter in R gives different results than Exponential Smoothing from statsmodels package? [closed]
I am trying to migrate my R model to Python. While doing so the forecasts for HoltWinters from R doesn't match the output of the Exponential Smoothing model from <...
0
votes
0
answers
5
views
Why is parallel bootstrapping in R slower than sequential bootstrapping (using boot and future packages)? [migrated]
I'm conducting a bootstrap analysis using the boot package in R with the option parallel = 'snow' (for Windows computer). However, computing in parallel is slower ...
0
votes
0
answers
39
views
How to evaluate estimation of treatment effect under wrong linear model ignoring replicated measurements?
A Simulation study with the following task is given:
Do 1000 simulation runs based on simulated data from the model below to explore the following issue:
How well is the coefficient of $x_1$ (...
2
votes
1
answer
23
views
as.POSIXct results in NAs for some of my data
I want to convert my date column into
Reproducible dataset:
...
0
votes
1
answer
91
views
Difference between anova () and summary ()? [closed]
Original post summary:
I want to run a two-way repeated measures ANOVA.
What is the difference between the following functions: anova(), ...
2
votes
0
answers
50
views
How to evaluate mixed model using lmer(), anova() and bootstrap when omitting random slope?
A Simulation study with the following task is given:
Do 1000 simulation runs based on simulated data from the model below to explore the following issue:
Fit a mixed model with random intercept but ...
0
votes
0
answers
26
views
How to interpret type-1-error, when omitting fixed effect from mixed model?
A Simulation study with the following task is given:
Do 1000 simulation runs based on simulated data from the model below to explore the following issue:
Do simulations where the regression ...
0
votes
0
answers
36
views
+50
Stochastic blockmodel with continuous weights in [0,1]
I want to use a stochastic blockmodel (SBM) to cluster the nodes in a network where the edge weights are continuous numbers between 0 and 1. It seems that R-packages such as ...
2
votes
1
answer
27
views
Testing for significance where results are expressed as a ratio to an in group control
I originally asked this question in the biology stack exchange site, but realise that it might be more relevant here in the stats site:
I have a large dataset that represents a library of yeast ...
0
votes
1
answer
26
views
How to derive points for each variable in nomogram by hand?
I'm dealing with nomograms at this time, but I don't really understand how to derive the exact points for each variable by hand (or in a mathematically way).
To be concrete, I brought a simple example:...
0
votes
0
answers
19
views
Is `mboxcox` available in R? [closed]
In this paper https://journals.sagepub.com/doi/pdf/10.1177/1536867X1001000108, the Stata package mboxcox is described. I tried ...
1
vote
0
answers
30
views
Error in lmerTest: The random-effects parameters and the residual variance (or scale parameter) are probably unidentifiable
I know that there have been similar questions before, but I dont still get it.
I would like to estimate a multilevel model with repeated measures in R using the package “lmerTest”. The model ...
1
vote
0
answers
18
views
Create lm-class object with cluster bootstrap in it (R), or: cluster bootstrap for sensemakr() [closed]
I have been trying to do some clustered bootstrapping using lm that I can then use in the package sensemakr(). If you're not familiar with it, it's an implemention of some ideas in Cinelli & ...
1
vote
1
answer
21
views
p-values based on clustered se with glm
I would like to retrieve the p-values from glm with clustered standard errors. I have used a function to calculate the clustered standard errors and then use these to generate a summary of the model ...
1
vote
0
answers
20
views
What statistical tests can I use in R to ascertain the statistical significance of clusters obtained using DIANA (DIvisive ANAlysis Clustering)?
I have a data set of cuticular hydrocarbons (CHCs) from 60 samples of aphids collected across mid, early and late activity season on three different plants species that they fed on. The CHCs can ...
0
votes
0
answers
22
views
Cannot invert "recomposed" matrix after spectral decomposition
Please bear with me here because I don't know much about linear algebra and even less about numerical linear algebra. I'm trying to write an R function that, at some point, decomposes a penalty matrix ...
1
vote
1
answer
14
views
Understanding predictions from early rounds of XGboost
I have a dataset that I am modeling with gamma regression via xgboost. The target variable has a mean of around 13,000. If I run xgb.train with nrounds = 20, my fit metric improves as follows:
...
1
vote
0
answers
23
views
A test to show that one list is greater than another [closed]
I have calculated cancer stemness scores (NES) for each cell in different cell types. When visualized, I can see that the peak of malignant cells has greater NES than the peak of heapocytes.
I ran ...
1
vote
1
answer
18
views
Is this the right approach to cluster using many different evaluations on the same dimension?
I'm working on a project where I want to sort political parties into two groups. I want to do so using the answers of many respondents in a survey who indicated for each party where they see them on a ...
0
votes
0
answers
11
views
Effect Size Calculation from 2-way ANOVA results: Meta-analysis
I am currently extracting data for a meta-analysis on continuous outcomes.
I am extracting means and standard deviations for two separate groups (patients and controls) and will later calculate ...
0
votes
0
answers
13
views
Contribution of species to DCA gradient - can one use RDA?
I want to quantify an observed gradient in a DCA (Detrended correspondence Analysis). The DCA shows two site types with species compositions. Along the DCA1 axis theres a clear gradient from site ...
0
votes
0
answers
20
views
Low False Positive Rates in glmm compared to lmm?
In R, I conducted a reaction time simulation on an interaction effect, where I simulated data with true effects, where the intercept is there, and no effect, where only main effects are present, ...
2
votes
0
answers
21
views
+50
Can I Perform a Micro Synthetic Control Analysis with Different Aggregation Levels for Treatment and Control Groups?
I am conducting an analysis using the microsynth package in R to evaluate the impact of increased police presence on various outcome measures obtained from an official survey. My treatment areas ...
0
votes
0
answers
15
views
Linear mixed model with dependent variable range constrained by predictor
I conducted an experiment where participants rated stimuli on a visual analog scale with a range between 0 (lowest possible rating) and 100 (highest) under two viewing conditions (restricted exposure ...
0
votes
0
answers
14
views
Coarsened exact matching (CEM) on longitudinal data
I want to compare the effect of 2 educational programs across time. In other words, I have tested 2 groups of students at 3 different time points (T1, T2 and T3). I have performed CEM on the data of ...
0
votes
0
answers
20
views
Transforming variables within MCMC to get the prior distribution to match proposal
I'm doing Bayesian MCMC where I am proposing some weights, say, a_1:a_5 from a Dirichlet distribution to ensure summation to 1. However, the prior (Beta) ...
0
votes
0
answers
10
views
How to offset, align and increase padding of dendogram labels [migrated]
I am trying to create a dendogram in R. As of now, I have used the factoextra package, and specifically the fviz_dend function. The code is as follows:
...
0
votes
0
answers
22
views
Predicted probabilities from a multinomial mixed effect with two random intercept ignoring one of the two random effects
My data is about an experiment conducted on 243 partecipants over 100 verbs in Spanish.
Partecipants had to guess from which base word the verb comes from.
So, I have repeated measures for ...
0
votes
0
answers
16
views
Unsure if spatial Autocorrelation is present or not
I built a classic linear model with 1000 data points for which I have coordinates. I thus checked for the presence of spatial autocorrelation with a bubble plot of the residuals and with Moran's I ...
0
votes
0
answers
17
views
¿Why would different evolutionary models render exactly identical fit to the same data, when calculating evolutionary rates? [closed]
When trying to estimate evolutionary rates for a physiological variable i found
identical fit when estimating it across strikingly different evolutionary models. It happened the same when using traits ...
1
vote
0
answers
10
views
MANOVA - Univariate Wilks' Lambda Test (R interpretation)
I am running a MANOVA model with 2 dependents and 2 continuous predictors. (fyi - STATA calls this MANCOVA and requires dropping a "c." in front of each predictor to denote that each is ...