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
1
vote
1answer
24 views

Residual deviance, residuals, and log-likelihood in [weighted] logistic regression

I would like to ask a question about the relationship between deviance, residuals, and log-likelihood in logistic regression. I'm currently fitting a logistic regression with a moderately sized data (...
0
votes
0answers
6 views

Individual-level factor as predictor in `mediate` command for multilevel models

I want to run a multilevel mediation model by fitting lmer models and feeding them to the mediate function in the ...
0
votes
0answers
29 views

Which model is a better fit?

Suppose I have 2 linear model such that: Linear model 1: ...
1
vote
0answers
30 views

Comparing significance of variables between each other

I would like to determine the significance of my variables in my model and compare them with each other. I have 6 explanatory variables. Here is my summary of the model: ...
0
votes
0answers
40 views

Reasoning for failure to reject $H_0$

Following up on this question, I would like to make an intuitive explanation of why i'm failing to reject $H_0$ ie that all varieties of wheat have same effect on yield. So, here is a boxplot: And ...
0
votes
0answers
4 views

Choosing a regression model for proportion data at the school level

I am working on a dataset where I have the percentage of students who passed at a test for each 189 schools in my sample. The data is aggregated, so I have the total number of student who sat the test ...
1
vote
0answers
18 views

Is is possible that 2 classifier give me the exact same results?

I'm trying to classify an expression dataset composed by 23 control person and 15 patient, I'm using LDA and RF that actually give me the same result(Sensitivity = 1 Specificity = 0.95 and accuracy 0....
0
votes
1answer
16 views

R models with unequal sample size

I am currently running GLMM in R for comparing correct response and response time in two groups (patients and control), each composed of males and females. I have 3 variables: Group, Sex. (inter ...
0
votes
0answers
5 views

How to provide fixed values for some random parameters in nlme in R?

I'd like to fit a mixed-effects logistic growth curve to grouped data using the nlme package in R. The function has the ...
0
votes
2answers
20 views

Interpretation of GLM Odds?

I have data on student graduation (1 = graduated, 0 = not graduated), as well as student gender and whether or not they were diagnosed with a disorder (categorical variable where it can be none, mild, ...
1
vote
0answers
17 views

Phylogenetically controlled multivariate analyses with both continuous and categorical predictors

My goal is to test whether native and invasive plants overlap in multivariate trait space while accounting for phylogenetic relatedness, and simultaneously determining which environmental variables ...
0
votes
1answer
15 views

cross validation using the SPSE in R

We have implemented an cross validation method in R. But we are not sure whether the error that it puts out is correct. We want it to give us the sum of predicted squared errors (SPSE), but in our ...
0
votes
0answers
8 views

Creating 'most marketable cohorts' from customer data

I have a massive dataset with all sorts of customer data and demographics. My aim is to produce something that might inform our advertising decisions in the future by ranking cohorts of customers most ...
0
votes
2answers
28 views

Simulate data based on linear regression and R squared

I have a small data set of 10 x,y points from which I can derive a simple linear regression. I'm looking to use this data set as a basis to simulate / predict additional "y" points as I have a much ...
0
votes
0answers
11 views

Next step after building GLMM logistic regresion: LRT, ANOVA?

I am a biologist in the middle of their PhD journey and I'm constantly learning new things about statistics but there are some things that are difficult for me to understand. Until now I had dealt ...
1
vote
1answer
28 views

How to check if a correlation exists between a continuous independent and a binary dependent variable

So this has been a headache for me. None of the resources I found could explain it in a manner I understand. Having two sets of data: ...
2
votes
0answers
23 views

How can I solve “horseshoe effect” on ordination analysis (Canonical Correspondence Analysis)?

I would like to ask for help in the analysis of Canonical Correspondence Analysis (CCA) that I did in the Vegan package in R, with my dataset of species and environmental parameters. The result ...
0
votes
1answer
15 views

Using and interpreting nested manova in R

I have measured the concentration of 7 elements in 30 Lakes. I have between 8 and 12 observations per Lake (i.e., I measured the ...
5
votes
1answer
142 views

Random Effects Results in R (plm) Cannot Replicate Results in Stata

I have been working on migrating a current project from Stata to R, where I have encountered difficulties with differing results of random effects regressions. I have panel data from an experiment ...
0
votes
2answers
55 views

Using anova function in r to determine whether factors have same effect

I have been asked to construct a linear model where yield is the response and all other variables are explanatory. Here is how I constructed the model: ...
0
votes
0answers
17 views

Generalized Least Squares for linear regression with continous and categorical predictors

I have a linear regression model in R studio with a continous and a categorical predictor, where the assumption of homoscedasticity is violated: ...
2
votes
1answer
19 views

Adjusted survival curves for cox model with time dependent covariate

I have found two ways to get an adjusted survival curve from a cox model with time dependent covariates (A and B). I am wondering which one (or if I am completely wrong how?) would be the appropriate ...
2
votes
1answer
29 views

Multilevel SEM with three or more levels in OpenMx

I am trying to figure out how to conduct analyses using CFA and SEM models with three or more levels. Pritikin et al. (2017) investigates how to conduct a three-level and up to five-level SEM using ...
0
votes
0answers
22 views

Drawing from 2 bags of different size and counting the number of outcomes

I have a combination problem that I can't get my head around. Similar problems were found here and here but are not quite the same of my problem. I have two sets of units and I want to find the ...
1
vote
0answers
13 views

Chi-Square Versus Fisher's Test Versus Welch T-Test

I am having a hard time to understanding when to use which of these tests. Fisher's test is useful for small sample sizes to compare categorical variables. Ok. Take a simple example, you have data ...
0
votes
0answers
15 views

Bayes Classifier example: is my work right? What does it mean?

I have this dataset and I am learning about Bayes Classifier. After data cleaning, I have tried to use Bayes classifier on it. I used R with this code: ...
0
votes
0answers
10 views

Store whether there was a convergence warning in a lmer ran via afex (R) [migrated]

I want to run many linear mixed models (one per time point of a time series). I plan to permute and correct for multiple comparisons later. The minimal example outputs the result below. Is there a way ...
3
votes
1answer
179 views

What can I say with mean, variance and standard deviation?

I wrote this code in R: ...
0
votes
1answer
20 views

Is Chi-square test okay to use when there's low number of individuals in cells in a large sample (n > 1000)?

Pearson's Chi-squared test data: tab X-squared = 61.663, df = 16, p-value = 2.738e-07 R here shows a warning that the approximation is incorrect because of ...
1
vote
1answer
14 views

Diagnostic Meta-Regression with mada in R

I am trying to figure out how to perform a meta-analysis of diagnostic test accuracy studies and I have a doubt that is driving me crazy. I am using the package mada written in R and following the ...
1
vote
0answers
23 views

How to identify the frequencies of periodic peak signals in a noisy time series? (with R)

Suppose to have two time series with peak signals at different frequencies, like these two: ...
0
votes
0answers
39 views

How to fit the intercept

I'm practising using R and I'd like to do this task: So I fitted the model: ...
1
vote
1answer
18 views

How to check if there is a linear relationship for a logistic regression model

From what I understand logistic regression expects that there is a linear relationship between the log odds of the target and the feature. Fourth, logistic regression assumes linearity of ...
0
votes
0answers
19 views

Reporting estimates in mixed models

this may be a stupid question, but I have run a mixed effects model in R and the estimates, Standard Error and dfs are are all numbers such as -2.115e-01. I've only seen these in p-values before and I'...
0
votes
0answers
17 views

How to define the random effect part of a linear mixed model for a repeated measure experiment?

I have some doubts about writing my model to analyze a repeated-measure experiment. Basically I have: 1 between-subjects variable (Group) that represents 2 different groups 1 Within-subjects variable ...
0
votes
1answer
29 views

how to compute p-value from Fisher's Z transformation?

I'm having a list of Pearson's correlation coefficients (r). Then, I performed the Fisher's Z transformation using the formula: z = 1/2 ln(1+r/1-r). Now, I want to compute corresponding p-values for ...
4
votes
0answers
154 views

How do I perform an actual “posterior predictive check”?

Note: If you downvote, please explain why so I can improve the question. If you only downvote I have no clue what should be done. This question is the follow-up of this previous question: Bayesian ...
0
votes
0answers
8 views

How to manage the influence of variables for lsa cosine?

I'm building reccomendation system for movies and the following data ...
1
vote
0answers
32 views

Which statistical model(s) can answer my question?

I have a large dataset (e.g. 1000) concerning nuclear radiation measurements (if I call it Z) where each data point is related to a barrel. These barrels must later on be deposited in a large ...
1
vote
1answer
53 views

Hypothesis Testing: Z-test or T-test? and how to test the null hypothesis?

I have a question as below: I have to generate two portfolio returns in R and compare their means. However, I am not sure which test should be applied in this case. And how can I indicate at least 2%...
0
votes
1answer
22 views

How to plot the relationship of two Likert scale variables?

I have two variables which are measured on a Likert scale. I ran the Spearman correlation test to test the relationship between them and they have a negative correlation coefficient (-0.729 with a p-...
0
votes
0answers
30 views

How to fit a probability distribution in R or Python using maximum likelihood? [closed]

This is different from fitting to sample data. Here, I have a vector X = (x1,x2,x3,.....xN) of size N and associated probability vector P = (p1,p2,p3,...pN). I need to find the best distribution that ...
0
votes
0answers
11 views

R - Is it possible to apply boot function to subselect dataset with very specific mean value? [closed]

I have a data of size 24 000 with mean around 2. It is not normally distributed. I would like to find all the possible combinations with only 15 000 data where the mean is around 1. Is bootstrap an ...
0
votes
0answers
14 views

model that responds with zero when one dependent variable is zero

Just wondering is something like this possible: model <- gam(y ~ x1 * s(x2), data = train.data) Basically, I need to model something non linear (see s(x2)), ...
0
votes
0answers
7 views

Heteroskedasticity testing with Breusch-Pagan in R, two functions — very different answers?

I am currently testing two different functions in R to determine heteroskedasticity in a regression model with 4 predictors, 2 continuous and 2 categorical. One function is telling me there is a high ...
0
votes
0answers
10 views

why the p value of chi square test from factanal and principal functions in R opposite? [closed]

I am getting p-value for chi square statistic such that from factanal the null hypothesis is rejected and while for same data using principal it is such that fail to reject null hypothesis. Is that ...
0
votes
0answers
12 views

Is it possible to calcuale CLV at an early stage for individuals?

I'm working on a project in which we have to predict the Customer Lifetime Value (CLV) for a group of customers. In order to calculate CLV in a non-contractual setting, we use probabilistic ...
0
votes
1answer
40 views

Friedman's test in SPSS gives different results from R and python

I have a repeated measurement of n=452 participants. The Friedman test of SPSS gives df=2, chi-square 36.970 whereas below is the output of R and python. I cannot explain this difference for chi-...
0
votes
1answer
65 views

Fixing convergence in SIR model using modified fit-model to fit COVID-19 data

I'm trying to model the data for covid-19 using SIR model in R. I followed the answer of the question, and the blog. I'm using the suggested code, However, the data does not converging. Any suggestion ...
0
votes
0answers
11 views

Random effects syntax in lme4 or nlme for linear mixed effects model

I’d really appreciate some guidance with specifying random effects in a model. I thought I’d designed quite a neat experiment, but I’m confused about how to correctly specify my experimental design in ...

1
3 4
5
6 7
455