Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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

1
vote
0answers
23 views

Understanding equivalence testing. Why there are two hypothesis?

I have to two groups and I would like to test that difference between means of these two groups is at least 0.02. I am using TOSTER R package. Here are details: ...
0
votes
0answers
9 views

I need to use quantile function (student) on spark [on hold]

I would like to know if there is a function on Spark(java) to compute the quantile function of student's distribution. The equivalent function on R is qt() Thank you for you help
1
vote
1answer
30 views

How do you deal with “nested” variables in a regression model? in R

A conceptual solution for this scenario has been posted in: How do you deal with "nested" variables in a regression model? Problem is I am having trouble using this solution in R - glm() ...
0
votes
0answers
8 views

Unbalanced Panel Data Fixed Effects Model with Instruments and Robust or Clustered standard errors

I'm an undergraduate with very little experience in R and Econometrics, so forgive me if I mix-up my terms a little bit. So far, I have gathered an unbalanced panel data set that contains student ...
0
votes
0answers
22 views

Getting main and interaction effects from Bayesian factorial ANOVA in Stan

I am using Rstan to build a factorial ANOVA model with two factors and their interaction. The sample dataset has 2 factors, A (levels A1 and A2) and B (levels B1, B2, B3) and 10 replicates for each ...
0
votes
0answers
45 views

Random Forest Model gives accuracy of 99.9% and AUC of 1 [duplicate]

I am trying to build a random forest model and have been getting a test accuracy of 0.998 and and AUC score of perfect 1. Now I know from intuition that this should not be happening but I am not able ...
0
votes
1answer
21 views

A few questions about the calculations behind the metabin function, part of the R 'meta' package for meta analysis of binomial data

I am new to meta analysis, and am reading about how to perform meta analysis with binomial data. I'm looking for some clarification on some of the results given by the metabin function, which is part ...
0
votes
1answer
27 views

nonlinear regression with time series error

I have a question about data analysis. I fitted my data to non linear regression by using nls function in R. Then I plot the residuals. The residuals are non ...
1
vote
1answer
35 views

Is this Time Series stationary?

The adf test makes me think it is indeed stationary, since p<0.01, we can reject the null hypothesis and so it would be reasonable to think it is stationary, but that peak is kind of out of place ...
0
votes
0answers
13 views

loop through R tidyverse pipe [on hold]

I have a dataset that looks like the attached excel file and I would like to loop through this dataset using the column variable "var_a" (numbers 1-127). For each number in var_a, I would like to ...
1
vote
1answer
32 views

Extremely large difference in AICs between two models

I am currently fitting a mixed model where I analye longitudinal trends in migration between country pairs (68335 observations nested in 6442 groups). One of the first questions I wanted to have ...
0
votes
0answers
41 views

Plot Cumulative Distribution Function of Kernel in R [on hold]

I am trying to plot $\hat F(x)$ of the log-normal kernel in R. It is a simple $\hat F(x)$ log-normal distribution with some transformation proposed by Jin and Kawczak (2003) (Check here if needed). ...
0
votes
0answers
17 views

caret predict.gbm function error: factor has new levels [on hold]

Similar to THIS question, I am getting an error in my prediction stating that one of my factors has new levels. I am using the gbm method from ...
0
votes
0answers
13 views

R Equivalent to sklearn/TfidfVectorizer? [on hold]

I want to create a document-term-matrix with tf-idf weighting in R. So far, I use the cast_dtm() function for this. In Python / sklearn, I can use the TfidfVectorizer from sklearn the following way: ...
0
votes
2answers
53 views

Can I do machine learning projects on a bad PC? [on hold]

I am trying to learn about machine learning and I've done some reading and tried simple task like the Iris dataset, but I've decided to go to a bigger project and got a couple datasets from some sites ...
0
votes
0answers
11 views

How to use rm() to remove bunch of variables in R [on hold]

I have 3 lists with similar name, and I would like to remove them in a smart way instead to type rm() three times. Here is example: list_1 <- list(x=1:2, y= 3) list_2 <- list(x= 1:3, y= "ab") ...
1
vote
1answer
39 views

How to fit a stepwise regression with ARIMA errors using Arima function in R?

I am fitting a regression model with ARIMA errors in R using the Arima function from the ...
0
votes
0answers
26 views

Assess impact on results of participants recruited via additional outreach efforts

I am currently working on a project that evaluates certain study recruitment strategies in regards of increasing participation among different subgroups. One of those strategies is reminder letters. ...
0
votes
1answer
28 views

R - how to estimate shape and scale parameters of Weibull distribution for claims development factors

I have a set of insurance data. Development factors fall with period, so follow Weibull distribution. I want to estimate Weibull parameters and smooth Development Factors. If I estimate parameters of ...
0
votes
0answers
12 views

Mixed effects model - use dummy variable to correct to reference/standard? [on hold]

I'm doing a mixed effects model that can be described generically (I'm doing a chemistry problem) as such; House price varies with distance from the centre of town. I'm fitting this as a quadratic ...
1
vote
0answers
22 views

Classification where classes do not use all features?

I am attempting a classification task whereby the features used to describe classes are not all being used. For instance, Class A does not use feature 2, class B does not use feature 4, and class C ...
0
votes
1answer
28 views

Compute $P(2\leq x\leq 8)$ with Poisson distribution and $\lambda=7.2$

Compute $P(2\leq x\leq 8)$ with Poisson distribution and $\lambda=7.2$ My attempt: I need calculate this using $R$. then I use this: ...
1
vote
0answers
20 views

Forecasts are at a different level to base in hts/combinef forecast

I am forecasting a multi-level hierarchy of smoothed series using the hts forecasting package. Some series have forecasts at significantly different levels to the input series. As pictured below, ...
0
votes
1answer
17 views

Quadratic Weighted Kappa metric in H2O package for model performance

I am running a multiclassification problem and before I make a function by myself I was wondering if anyone knows of a pre built quadratic weighted kappa function in the h2o library.
0
votes
0answers
13 views

How can I write Array formula from R into excel, for example {=C2:C11*D2:D11}? [closed]

I use library("openxlsx") writeFormula (wb , sheet = "data" , x = c ("SUM(A2:A4)", "AVERAGE(B2:B4)", "MEDIAN(C2:C4)") ,sep='')) , startCol = "X" , startRow = 4 ) And into Excel, I see: ...
1
vote
3answers
77 views

Visualize binary trait distribution in two groups

I'd like to visualize the trait distribution within two groups (e.g. case and control) for paper i'm trying to prepare. The issue is that trait is binary (has only two state: "0" and "1"). My solution ...
0
votes
0answers
26 views

One-sided variance test in r [duplicate]

I would like to compare variances of two independent samples (of different sizes) from two unknown distributions. It seems I should use a one-sided nonparametric test. Bartlett's and Fligner's tests ...
0
votes
0answers
10 views

What do the outputs of the function dlmSmooth from R's dlm package mean?

In the vignette for the R package dlm: link on page 12, the author runs the function dlmSmooth to smooth the data and the function returns an object which is ...
1
vote
0answers
15 views

fitting COM-Poisson in R

I have some crash data I did Poisson for that and the data was underdisperesed. I want to do COM-Poisson regression for my data. I see that every website suggest several packages for COM-Poisson and I'...
0
votes
0answers
15 views

Alternative-specific coefficients in mixed logit in R

I am trying to estimate a random coefficients logit model in R mlogit where random parameters occur for the cost of travel the <...
2
votes
1answer
38 views

How to read checkresiduals graphics in R?

I need to check the residuals of two models in R so I can determine how bad or good are said models. First, I've started simulating an INAR(2) model and wanted to fit a more convenient model, then, ...
3
votes
0answers
30 views

Does any `R` package offer `gnorm`, `hnorm`, and similar? What about other languages?

R typically offers functions prefixed by d, p, q, and r ...
-1
votes
2answers
33 views

Cauchy distribution: R code [closed]

Generate 1000 sets of numbers from the Cauchy distribution. Do this for set size 2, 5, 10 and 20. Compute the median of each set. Find the distribution of the medians, for each set size. How do I ...
1
vote
0answers
11 views

Different estimates in multilevel meta-analysis for categorial moderator vs. subgroup analysis

I am conducting a three-level meta-analysis using metaSEM in R. I want to find out the mean effect size for four subgroups of my dataset and later I also want to use these groups as a moderator. My ...
1
vote
1answer
23 views

State space with lasso

Is it possible to incorporate lasso variable selection in the high dimensional state space model. If yes, is there any code or package available in R
0
votes
1answer
28 views

Different results from wilcoxsign_test - which test to use?

I am running a wilcoxsign_test from the coin-package and I get different results depending on whether I split my data or not. My data is a data.frame with 3 columns: "Proband", "Treatment", "Mdev". ...
0
votes
0answers
36 views

Determining the Direction of Eigenvectors in PCA [duplicate]

I'm using R to get the principal components for several datasets. An example result, using prcomp yields: ...
0
votes
1answer
13 views

Calculating Bayes Factor from Z score, n, and No

I'm completely stuck on how to get this answer from a course below. I guessed the answer, but I'm lost on how they get to it. I did the following in R ...
0
votes
0answers
17 views

Different backgrounds, different similarities with ecospat (R language)

I beg all of you your excuses, because the stupid question. I am exploring niche conservatism in five species of Ericaceae. I created two backgrounds sets in order to explore niche similarity (using R ...
0
votes
3answers
78 views

What are weights in a binary glm and how to calculate them?

I have a dataset that includes four variables. Three of them are factors and one is constant. My response variable contains (0,1) so my glm is about logistic regression. My question is, how do I know ...
0
votes
0answers
9 views

Initializing structural expectation maximization for learning Bayes net structures

I am using bnlearn in R to learn Bayesian network structures. It has a structural.em method for learning with missing data that ...
0
votes
0answers
15 views

How to run a SEM mediation test with common method bias

Say the model I am working with is simply: M <- IV DV <- IV + M All three constructs are obtained using the same survey, hence the common method bias ...
0
votes
1answer
26 views

How to evaluate if year-over-year data is correlated and predictive

I'm working with data that is separated by year and classification and want to test if the data is correlated over each year. Essentially, I want to determine if the data is random each year or one ...
0
votes
0answers
7 views

Multiple Imputation using aregImpute and fit.mult.impute for (1) Chi-square test across groups and (2) Kruskal-Wallis [closed]

I would like to compare parameters across groups in a dataset which I have used multiple imputation (via aregImpute). First, several continuous parameters are such that I would like to use the non-...
1
vote
1answer
18 views

Differences in extreme values of two similar distributions with slightly different means

It is common to use, explore and test differences in attributes between groups. While often people are interested in significant differences and large effect sizes, I was wondering about the effect of ...
2
votes
0answers
37 views

How do I fit a cumulative Gaussian distribution in R? [closed]

I am trying to fit a cumulative Gaussian distribution function to my data, but I'm not sure how to do this. From what I understand, the fitting process tries to find the mean and standard deviation of ...
4
votes
0answers
82 views

Mixed-effects logistic regression

I'm new to data analysis and I'm trying to perform a mixed-effect logistic regression. My data look like this: ...
0
votes
1answer
35 views

Fitting model with unstructured covariance matrix with gls in R

Consider the following dataset: library(nlme) library(lme4) data<-sleepstudy data<-data[data$Days<5,] data$b<-sample(0:1,nrow(data), rep=T) I am ...
0
votes
0answers
17 views

Historical average with exponential smoothing model [duplicate]

This topic similar with this one R Time Series Analysis forecast result always remains same But I perfrom exponential smoothing model in R. ...
1
vote
0answers
16 views

How to tell R the meaning of a numerical variable and plot them? [closed]

I have a large data set in R which I am currently analysing. I'm trying to plot confounding variables and have one which considers the patients household equipment (2=none, 1= stove, 3= charcoal). ...