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
2
votes
1answer
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 ...
0
votes
0answers
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 ...
0
votes
1answer
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 ...
1
vote
0answers
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 ...
0
votes
0answers
17 views
0
votes
1answer
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 ...
0
votes
1answer
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 ...
1
vote
0answers
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 ...
1
vote
1answer
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. ...
0
votes
0answers
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 ...
0
votes
0answers
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 ...
0
votes
0answers
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 ...
1
vote
1answer
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 ...
0
votes
0answers
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 ...
1
vote
1answer
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 ...
1
vote
1answer
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 ...
0
votes
1answer
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 ...
0
votes
1answer
26 views

Contradictory results when estimating GJR-GARCH(1,1) with rugarch package

I am using financial stock data (1588 observations, daily returns) to estimate a GARCH(1,1) and a GJR-GARCH(1,1) model. A GARCH(1,1) takes the form: $\sigma_t^2 = \omega+\alpha_1 a_{t-1}^2+\beta_1\...
1
vote
0answers
8 views

Computing ECDF of a data for parameter estimation using weighted nonlinear least square in R [migrated]

I am writing a code for estimating the parameter of a GPD using weighted nonlinear least square(WNLS) method. The WNLS method consist of 2 steps step 1: $(\hat{\xi_1} , \hat{b_1}) = arg\ \min_{(\xi,b)}...
0
votes
0answers
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 ...
0
votes
0answers
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 ...
0
votes
0answers
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 ...
1
vote
0answers
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: ...
0
votes
0answers
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 ...
0
votes
1answer
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 ...
0
votes
0answers
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; ...
0
votes
0answers
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): *...
0
votes
0answers
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 ...
0
votes
1answer
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 ...
0
votes
0answers
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 ...
0
votes
0answers
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: ...
1
vote
0answers
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 ...
0
votes
0answers
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 ...
0
votes
1answer
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 : ...
2
votes
1answer
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.) ...
0
votes
0answers
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/...
3
votes
1answer
40 views

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

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

Interpret the skewness in R

I have a skewness(x) equal to [1] 0.51308. Does this mean the graph is positively skewed or it is said to be symmetric? My ...
0
votes
1answer
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 ...
1
vote
0answers
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 ...
0
votes
0answers
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' ...
0
votes
1answer
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: ...
0
votes
1answer
94 views

How can you use Envelope Rejection Sampling to generate samples from a posterior distribution?

Considering two independent random variables: $$X \sim N(-1, 2^2) \;\; \text{and} \;\;Y \sim N(1, 1^2).$$ Assume we cannot observe $X$ and $Y$ directly but instead observe: $R = \sqrt{X^2 + Y^2} + \...
0
votes
1answer
19 views

How are R-square and mean absolute error related? Which is more important for evaluating performance?

I have some data which is divided into training and test. I ran regression using training data and got an R-square value of 0.8, and a mean square error of 10 using the original and predicted values ...
0
votes
0answers
10 views

introduction to POMDPs?

Any recommendations for spinning up on partially observable markov decision processes and related modeling methods? We're starting a project to match trainees with sparring partners in a way that ...
1
vote
1answer
41 views

Must the QQ-plot line be at a 45 degree angle? [duplicate]

A qq-plot for a regression I ran looks like this: My understanding was always that there should be a 45 degree angle, i.e. from approx bottom left to top right corner. Must that really be the case? ...
0
votes
2answers
56 views

Power analysis using R gives contradicting result using an estimated sd

Suppose we are to find if the yield of a crop is greater than the previous yield $\mu_0$ with a specified level of significance $\alpha=0.05$. The population variance is unknown. My first sample has a ...
0
votes
1answer
20 views
0
votes
0answers
14 views

How does the GLMNET standardize = TRUE option work?

I am struggling to find information about how the standardize = TRUE option as part of the glmnet or cv.glmnet calls works. My understanding (although it might be wrong) is that when the ...
2
votes
0answers
35 views

Linear Mixed Models with GARCH Errors

Currently, I'm trying to analyze the factors affecting rice prices in certain localities over five years. I have monthly data on rice prices of 60 localities for 2015 to 2020. I would like to ...