The Stack Overflow podcast is back! Listen to an interview with our new CEO.

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

doing bernoulli in r

The question might be too simple, but sometimes I see an extra "+1" in parameters passed to distributions, For example for Bernoulli I would do: ...
0
votes
0answers
11 views

Simulate recurrent events data where last observation is censored

I would like to simulate a recurrent events dataset for survival analysis with cox regression in R. The data should have the following properties: multiple, varying number of observations per ID only ...
0
votes
1answer
21 views

R: MTP in multtest creates different estimates from glm for test=“lm.YvsXZ”

I apologize if I am completely missing something fundamental about what I am trying to do here. I am trying to use MTP to estimate adjusted p-values for a much more complex regression, and I keep ...
0
votes
1answer
68 views

GLMM for continuous response in $[0, 1]$

I am looking into GLMMs because my linear model residuals' plot has a weird pattern (some residuals form a diagonal pattern), and a lack of normality was also confirmed with a Shapiro test. ...
0
votes
0answers
17 views

Why the huge difference between the results from pca and spares pca using R [closed]

I am using "elasticnet" package to do the sparse PCA in R. I could get the percent of explained variance of each PC. However the explained variance from sparse pca is much smaller than that from ...
1
vote
1answer
18 views

finding the within-person SD from a null model lme output

I just wanted to make sure I'm interpreting my lme() output correctly. I've set up a null model because I was told I could find the within-persons SD this way (...
0
votes
0answers
10 views

How to show performance of one machine learning model is significant to other model? [closed]

I have 3 different models trained and tested on same dataset, and evaluated by Pearsons R, Root Mean Square Error (RMSE) and so on... I see that evaluated scores of one model are better than others, ...
2
votes
1answer
21 views

Why forecast::accuracy() mape is working with 0/0?

I'm learning now some metrics of goodness about time series forecasting, using the forecast package, but I'm stuck in something that surely I've not understood well....
1
vote
1answer
24 views

auto.arima with an input of another series

Two time series, which are related to each other. I want to see if "order" helps in predicting sales, by running auto.arima ...
0
votes
0answers
14 views

How to obtain different values of “parameter k” in a mixed-effects negative binomial model?

I have a dataset with two level factors - fertilizers ("Nitrogen" or "Phosphorous") that differed in their concentration level("...
1
vote
0answers
37 views

PowerSim function (simr package) indicates 100% power for small sample dataset, regardless of effect size, alpha level, or if fixed/random slopes

I am using the simr package to do power analyses for lmer multilevel models I have run, to determine the power of a pilot dataset for future research. The dataset consists of 46 subjects with ...
3
votes
1answer
29 views

How to combine the results from two poisson regression analyses into one

I am very new at both R and statistical analysis and thus have very limited knowledge, so please bear with me! I have a dataset with country-year data based on event counts, but data for about half ...
0
votes
0answers
15 views

Finding stability in a time series of success/failure data — Mixed Model Random Effects

I have a very large data set of success/failure data for hundreds of subjects. The chance of success is rather small but does/should stabilize over time. Subjects have varying levels of observations/...
1
vote
1answer
20 views

How to analyse an impulse response function with more than 2 variables?

I am running an impulse response function in R, using the package vars. My data has 3 variables, the inflation (Brazilian CPI, or IPCA), the exchange rate and the output gap. My goal is to calculate ...
0
votes
0answers
26 views

Statistical test to compare two proportions

I am performing a meta-analysis comparing proportions of patients diagnosed with a disease based on 2 different diagnostic criteria. I have collected and pooled proportions rates (patients with a ...
0
votes
0answers
13 views

How to get adjusted explained variance of PC using Sparse PCA in R

I am using "elasticnet" package to do the sparse PCA. However I could only get the percent of explained variance of each PC. I am wondering can I get the adjusted explained variance of each PC using "...
0
votes
0answers
11 views

Cross-validation vs. F-test : Curve fitting using penalized spline regression

This question relates to a previous post here. I have a curve with a disturbance in the middle (at t=9) which causes a downturn (t<9) and an upturn (t>9) in my data. I would like to use curve ...
1
vote
0answers
53 views

Simple Bayesian meta-analysis in R [closed]

Is there a simple way to conduct a Bayesian meta-analysis in R in order to support equivalence between the effects of two study types? E.g., Bayes factors would be perfect. So, for example I have ...
1
vote
1answer
26 views

AIC and BIC values by auto.arima and manual ARIMA

A time series of yearly data, I want to compare the AIC and BIC values by auto.arima and manual ARIMA. ...
0
votes
1answer
51 views

Help interpreting output from glmmTMB and Ben Bolker's overdispersion function

Just wondering if anyone can help with interpreting the output from Ben Bolker's over-dispersion function (please see link below): https://bbolker.github.io/mixedmodels-misc/glmmFAQ.htmlhttps://...
0
votes
0answers
30 views

How to aggregate individual results with CausalImpact

In this answer, the author's suggestion is to: aggregate the individual MCMC traces and then summarise the result in terms of an expectation and a credible interval I understand that the MCMC ...
13
votes
3answers
260 views

How can I fit a spline to data that contains values and 1st/2nd derivatives?

I have a dataset that contains, let's say, some measurements for position, speed and acceleration. All come from the same "run". I could construct a linear system and fit a polynomial to all of those ...
1
vote
0answers
30 views

Why do a paired t-test and lm give different t-values in R? [closed]

I was playing around with some data, trying to get a grip on doing contrasts for within-subjects designs in R. I've noticed that, as far as I can tell, using lm or <...
1
vote
0answers
21 views

Why can removing a non significant interaction term from a factorial ANOVA cause a main effect to become significant?

I'm running a 2x2 ANOVA analysis in R - the model is linear. The maximal model (containing a continuous DV, one 5-level categorical IV, one continuous IV and the interaction term) yields an output ...
0
votes
1answer
36 views

How to decide threshold values for AUC?

With respect to the pROC package for R(https://rdrr.io/cran/pROC/man/ggroc.html). ...
0
votes
0answers
10 views

How to properly perform “change from baseline” (pre-post) analysis adjusting for pre using lme4 in R?

Let's assume I have the following data set, consisting of pre (t1) and post (t2) measurements. I want to check, if there is a significant effect over time (t1, t2). ...
2
votes
1answer
36 views

Poisson on frequency data with many 0, underestimated output

I have got a frequency table of how many events occur within a 5-minute time window. ...
0
votes
1answer
96 views

Why do these independant variables have significant explanatory power, when 'theoretically' they should have none? (Self contained example inside)

I am putting together a model which involves a simple linear regression, and to aid the development I have put together a process for generating synthetic observations. The idea is that you have ...
0
votes
1answer
29 views

Planned comparisons with ridge regression

I have a data set that consists of 1 response variables (e.g., response time) and 20-30 predictors variables with a mixture of categorical and continuous data. I code the categorical data into dummy ...
0
votes
0answers
11 views

Can I use partial eta and/or partial omega squared for effect size estimation of each independent variable in linear mixed model regression?

I need to estimate effect size estimation of each independent variable in linear mixed model regression. Here is a code: ...
0
votes
1answer
15 views

sum of probabilities doesn't match, using HistogramTools in R

I was using the package HistogramTools in R to create Histogram. > H<-hist(1:100) > sum(H$density) [1] 0.1 Somehow the sum of the density is not 1, ...
0
votes
1answer
30 views

Get odds ratios with confidence intervals from a lasso regression model

I try to understand lasso regression. So far, I do understand that it can be used to shrink regression coefficients in case of few events. The coefficients of some covariates are even shrunk to zero. ...
0
votes
0answers
13 views

Compare responses of two groups of their responses to how they rate their preference

Two groups of respondents where asked to rate their concern on 1-10 Likert scale (which effectively means ranked responses). In effect, for each groups, I have a number of respondents who ranked their ...
3
votes
0answers
56 views

Quantile regression and linear regression coefficient comparison

I am trying to understand the concept of quantile regression by modelling the monthly expenditure on insurance on several variables. The R package ...
0
votes
0answers
23 views

Interaction in a Binomial how interpret

So, my doubt is simple, I ran this model: glm(formula = pregnancy ~ Bull*SEMEN, family = binomial(), data = dt) Just 2 bulls (a and b) and 2 semen (s and c) ...
0
votes
1answer
25 views

checking accuracy of a forecast [closed]

I am trying to predict future sale of a product by using holt-winters imp info: nextsalesf contains the forecast for next 5 periods val$Qty.2011001FBL0010250[5] is the known values of next 5 ...
0
votes
1answer
34 views

Using Logistic Regression to simulate data

I want to simulate data of the form: $$ Z=e^{X_1+X_2}+X_3 + \epsilon $$ for i.i.d. $X_1,X_2,X_3\sim\mathcal{U}(-1,1)$ and $\epsilon\sim\mathcal{N}(0,1)$ I have (using R) generated 10,000 ...
0
votes
1answer
19 views

Power analysis in R - Sample size

I have a question regarding power analysis in R using the following function: library(pwr2) pwr.2way(a=2, b=8, alpha=0.01, size.A=12, size.B=12, f.A=0.47, f.B=0.4) ...
1
vote
0answers
12 views

How to validate Item-Based Collaborative Filtering?

So, I made an books recommender system engine (with R) which based on item-item matrix. I've made the whole system fully works the output will give 5 recommender system. But, the question is how can I ...
-5
votes
0answers
99 views

What do bootstrap points indicate in a Cullen and Frey plot?

I have a set of 10 samples as follows: ...
2
votes
2answers
54 views

GLM model interpretation of quasi poisson incorporating dispersion in R

I am fairly new to GLMs, and am currently working with a quasipoisson distribution due to overdispersion. I have read through the relevant sections of Mixed Effects Models and Extensions in Ecology ...
0
votes
1answer
29 views

What is the best programming language and regression method for this private equity investment dataset? [closed]

The excel (can be csv) dataset I want to work with has thousands of company names, and for each company, a few rounds of investment. This means many mentions of the same company but with different ...
0
votes
0answers
21 views

predicting X values from smooth.spline

I have an existing smooth.spline object, and I wish to estimate X values for a set of new Y values. I see that ...
0
votes
1answer
19 views

Anova output Variables meaning [closed]

I have this output from R that I'm trying to understand. I would gladly appreciate any help! ...
0
votes
0answers
11 views

Inter-rater reliability or intraclass correlation for one subject

I'm looking for a way, in R, to get measures of agreement for each item. I have 32 ordinal items (we want separate statistics for each), and 66 raters.I have two subjects, but we want to look at the ...
0
votes
0answers
15 views

RCB ANOVA: Degrees of Freedom wrong?

I am running an ANOVA analysis on randomised complete block RCB design: 7 Genotypes 6 Blocks Ratings The model I am fitting is: ...
2
votes
0answers
37 views

How to deal with zero-inflated proportional data in GLMM?

I have proportional data, i.e. number of individuals out of 6 that choose a certain option in a multiple choice experiment, so there are just 7 possible outcomes for each option: 0/6; 1/6; 2/6; 3/6; 4/...
0
votes
1answer
19 views

Levene's test with a two-way anova

I am trying to perform a levenetest on my two-way anova. leveneTest(Score ~ Party + Group, data = Data) But R just screams at me saying ...
1
vote
0answers
14 views

Logistic regression for repeated measures using R [closed]

I'm trying to build a logistic regression model for a longitudinal data. The outcome variable is the status which says if the respiratory status is either poor or good. Each pacient/subject was tested ...
0
votes
0answers
18 views

conversion of multivariate time series into functional data analysis

i am trying to generalize the functional autoregressive model of order one to some order p, for this i calculate the functional principle components, and choose a particular pcs which explain a given ...