# 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.

26,332 questions
Filter by
Sorted by
Tagged with
33 views

### Stochastic Gradient Descent Code Check for Least Squares

I have an R-based implementation of the gradient descent and am trying to also get it to work as SGD. The function matches R's lm function when using the entire data set. But, when I sample from the ...
27 views

### How to get the variance explained by each term in a GAM

I am applying a gam model and I would like to know how can I get the proportion of variance explained by each of them. The output using the summary is like that: Do you know how can I get that? I ...
23 views

### How to handle missing data in a time serie knowing that the mean will be used in further modelling?

I need to run a survival analysis and use environmental data containing missing values. The environmental data are per day, and I actually want to use the mean of each variable during (let's say) the ...
14 views

### How does the R function confint calculate confidence intervals for a model averaged object from MuMIn?

I've been using the MuMin package in R to create model averaged estimates from a candidate model set and the documentation suggests that you can use confint() to create confidence intervals for the ...
17 views

### Interpretation of residuals vs Fitted plot in combination with coefficients in multiple logistic regression

This is my coefficients results ...
37 views

### Very high intercept in log-normal linear regression in R

I ran multiple linear regression in R. I have a skewed Y variable and log transforming it gives better results. I didn't transform any of the x variables. Thus, in order to interpret the coefficients ...
129 views

### Correct Interpretation of Survival Curves

I am interested in learning about how decisions (e.g. prioritization of treatment) can be made in the real world based on Survival Curves (e.g. Kaplan-Meier). To illustrate my example, I simulated a ...
28 views

### Understanding the Tweedie Distribution

I am trying to better understand the basic details and properties about the Tweedie Probability Distribution. The Tweedie Probability Distribution is a bimodal probability distribution function which ...
10 views

### What is the best way to validate whether a set of given scores are a good predictor of a success metric?

For example, I have a table of items each with the given scores (no unit) and success metric (quantity value). The success metric is the real-life performance indicating number of items sold, etc. ...
23 views

### How do I interpret regression coefficients with PCA scores as dependent variable?

I am performing a PCA on four variables all measuring performance on a test in some way. Now I want to use the scores of the first principle component (test1_pca) as dependent variable in a linear ...
45 views

### Correct formulation for getting the F-test, p-value

I am reviewing some code that is used to calculate the efficiency of the elecitrical distribution companies in Denmark. In short, this method measures all the companies up against each other, and then ...
8 views

### R: Estimating LASSO and elastic net across multiple time-series CV approaches

This question is of a disapproved format and I am sure that I deserve to have some points taken away, but I hope someone will have pity on me and answer me anyway. I have been given access to a ...
55 views

### Logistic LASSO regression model in R (glmnet) - predictions very close to 0.5 and bad misclassification error

EDIT: Earlier this question got closed because my question was not precise enough and really contained several questions. I have now tried to make the question more precise. I hope it's ok now. I ...
30 views

### Which R functions are correct for estimating partial Eta Squared for effects in multiple linear regression with interaction terms?

There are a few functions in R available for calculating partial Eta Squared, such as: effectsize::eta_squared ...
16 views

### Performing post-hoc tests on a GLM with Gamma distribution

I am analyzing data that is gamma distributed. Hence, an ANVOA was a good choice but a GLM with gamma distribution worked well. To report the data I want to compare all groups to the control treatment ...
66 views

### Change shape parameters in a beta distribution based in each datapoint [closed]

I am new to Bayesian statistics and I have been trying to implement a Beta Binomial model from a PhD thesis in rjags. The thesis describes prior distribution for the variables but I am stuck in how to ...
27 views

### Should we include a potential predictor into a prediction model if its P value is >0.05 but it improves AUC and/or model fit?

I am in the process of finalizing my logistic prediction model. However, I am not sure whether to include some specific predictors. I read about many papers and they left predictors in the final ...
26 views

10 views

### R glmer formula syntax

I am planning an experiment and am trying to work out how to test my hypothesis once my data are collected. The experiment would test the effect of 3 different treatments (A, B, & C) on ...
9 views

### Likelihood Ratio Test on Ordered Probit Models (Panel Data) in R

I am in desperate need of help. I need to perform a likelihood ratio test on my panel data ordered response models to decide whether it's better to use the standard or the Random Effects Ordered ...
20 views

### Likelihood ratio test vs. marginal/conditional R-squared in linear mixed model

I understand likelihood ratio test is always used to test the goodness-of-fit of two competing models (full vs. nested). But lmer in R also gives R-squared (marginal or conditional). I have three ...
16 views

### how to find margin of error of the interval for the true slope of Up in following senarios? [duplicate]

An individual 80% interval Bonferroni correction and scheffe with a family-wise confidence level of 80%. I have a data of: ...
15 views

### categorical variables longitudinal analysis

I am estimating the predictive capacity of multiple metabolites in different outcomes for a large population that has 3 follow ups. For this I am building linear regression models in two different ...
30 views

### After fitting glmer model, I plot the model, but it looks weird (see figure)

I have species richness data and serval environmental data. My study design is nested i.e, 30 sites, with each site has 2 - 8 plots, and each plot has 20 quadrat. I used the species richness from each ...
34 views

### Calculating willingness to pay in mixed logit model with lognormally distributed price parameter

I am analyzing data from a discrete choice experiment (five attributes, including price attribute). For the mixed logit specification, I assumed normal distribution for the four non-price parameters; ...
44 views
+50

### Dealing with multicollinearity across dependent variables

In an experiment, participants rated each of several musical stimuli on 5 dimensions (ratings A to E). For each of the ~3,000 trials, the independent variables were (* = critical manipulation): *...
36 views

### How to get a meaningful loading while ranking by PCA with first component in R

I was thinking if there is a way to impose constraints on variables so that the loadings with first principal component takes values according the signs imposed to it in R. I have seen some of the ...
24 views

### Singularity issue in lmer (mixed model)

I was trying to test state-level variation in a mixed model to predict attitudes using lmer() function. My original code was ...
20 views

### The use of PCA in the regression

I'm a student of social science. I'm now learning the PCA and I hope to use the PCA scores as one of the explanary variables. The variable c52 is my dependent ...
14 views

### auto.arima with xreg in-sample performance worse than univariate

Based on this discussion ARIMAX vs. Regression With ARIMA Errors and the blog post link https://robjhyndman.com/hyndsight/arimax/ , I have tried the following: ...
22 views

### Interpreting Autocorrelation plots in R

I am trying to interpret the following plots I got in R using the checkresiduals() function. The first plot is the model I am replicating without any correction for autocorrelation, while the second ...
19 views

### "Group mean centering" a dummy Variable in R for multilevel analysis: how can i do this?

have somebody an idea of how to group mean center a dummy Level 1 predictor in R? Enders & Tofighi (2007) describe a method to center a dummy variable through substracting the proportion of the ...
21 views

### Probability Calibration of Statistical Models

I am trying to better learn about the Probability Calibration of Statistical Models . For example, if a Random Forest model is trained on a binary supervised classification problem : ...
31 views

### Is there a way to verify if numeric data was falsified? Would a simple randomness test work in this situation?

I have a string of numbers that are intended to represent certain stats over time, but some of the numbers appear to be staged to my eye, including a lot of repeating integers (e.g. 121, 5335, etc.) ...
31 views

### Clarification on r caret package confusionmatrix

I just want to make sure I'm understanding the "confusionmatrix" function in the "caret" package correctly. Looking at the worked example found here: https://rpubs.com/dtime/...
40 views

### Interpreting logistic regression in R with huge OR: Strategies to interpret

My dataframe looks like this -> dput see at the end: ...
13 views

### Interpret the skewness in R

I have a skewness(x) equal to  0.51308. Does this mean the graph is positively skewed or it is said to be symmetric? My ...
23 views

### Analysing change over time

I have an ordinal variable (11 cat), measured twice a day (morning and evening, not at the same time) for about a thousand living objects for several months. What's a sensible way to analyse change ...
21 views

### Heatmap correlation with categorical variables

I've got a data table with Premium - the continuous dependent variable to be predicted and other independent variables such as Age, Height (continuous); Diabetes, Transplant (0: No, 1:Yes). I want to ...
17 views

### questions about the use of clustering in social science

I'm a student in social science. Recently i'm learning clustering, but I really can't understand how can we use clustering in our social science research. For example, I use the 'gender consciousness' ...
34 views

### Cox model with multiple measures does not recognize the number of IDs?

I am running a survival cox model with multiple measures, here is the code: ...
94 views

20 views

### Interpretation of Weibull Survival Time Prediction from a Survreg Object

Code is somewhat like this: ...