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
0
votes
0answers
8 views

Factor levels different in Training and Testing data in ensemble models

The problem is as follows: (I did all of this in R in case it will make any differences) I have a df with $\sim1000$ rows and $122$ columns (variables), in which the last column is my target variable. ...
0
votes
0answers
9 views

R XGBoost Tweedie Regression Objective Function

I’m trying to implement the XGBoost Tweedie regression objective function in R (so that I can test some changes later). The c++ implementation is shown here. Specifically: ...
0
votes
0answers
8 views

Bad predictions for unbalanced data

I'm studying the behavior of machine failures in a production scenario. For this, I generated random data to form my imbalanced training set, consisting of categorical data, which indicate whether or ...
0
votes
0answers
12 views

Monte Carlo test for probability of occurrence

I have the following figure from the following data set: [Link to data] (https://www.dropbox.com/s/29zgm8nm39qyh7m/data_rainfall.csv?dl=0) There are four columns (Year, Month, Day, Phase, and Rainfall)...
1
vote
0answers
14 views

Can't reproduce confint profile likelihood results [closed]

I'm trying to follow this answer here and the linked paper. But I can't seem to get the same results as the confint gives. Sometimes I get something very simmilar, ...
0
votes
0answers
10 views

What does the 'cor' parameter in prcomp() do? [closed]

I came across some R code that contains the following line: prcomp(data, scale=FALSE, center=TRUE, cor=TRUE) I understand the ...
0
votes
0answers
8 views

Extract smooths from different gams with mgcv and combine them in one plot [closed]

I asked this question already a little confusing here: https://stackoverflow.com/questions/63110106/combine-gam-smooths-of-multiple-covariates-in-one-plot-in-r?noredirect=1#comment111857791_63110106 ...
0
votes
0answers
38 views

Deducing information from a scatterplot

I have two tiff files in R (one modelled and one observed). Both tiffs show the spatial maps of gross primary productivity from 2000-2010. The study area is HinduKush Himalaya (http://rds.icimod.org/...
0
votes
0answers
4 views

moderation (latent variable * gender) analyses using lavaan

Hi I'm following https://stackoverflow.com/questions/24399353/r-lavaan-coding-latent-variable-interactions to run moderation analyses. My model is a bit different from the example in the link so I ...
1
vote
1answer
23 views

Best way to set an interaction in a regression between two factors when some interactions are impossible?

I'm interested in determining how territory size (a continuous variable) changes as a function of species (a factor with 3 levels for the 3 species) and region (a factor with 2 levels, north and south)...
0
votes
0answers
12 views

Time series demand categorization [closed]

I'm a beginner in R What I have: Sales_date.csv contains the historical daily unit sales data per product ( 3 colums: Product name, Demand, Date) What I want to do: categorize the demand off all the ...
0
votes
0answers
9 views

Cluster large dataset in R

I have a very large dataset (200M observations) with spatial points around the world with a ground resolution of 30m. I would like to assign clusters based on a minimum of 33 points per cluster and a ...
0
votes
0answers
20 views

Why AIC for log-linear model in glm returns Inf?

I am trying to calculate the AIC for log-linear model in R, but i get Inf as a result. The model aim is to predict sales in euros based on some variables. As far as ...
1
vote
1answer
37 views

How to calculate the variance and expected value of a random variable with density function f(x) in R

was wondering how to calculate the expected value and variance of some function f(x). For the Expected value $\mu,$ I integrated x*f(x) and I'm confident that is correct, but I'm confused about how to ...
1
vote
1answer
21 views

Non-significant ANOVA interaction term despite 95% confidence intervals not overlapping

I plotted the means and 95% confidence intervals for survival data with the paired bars corresponding to 2 different study sites that each contain two experimental treatments (white = low shelter, ...
0
votes
0answers
13 views

How to calculate variance and expected value in R given some function f(x) [duplicate]

I was wondering how to calculate the expected value and variance of some function f(x). For the Expected value, I integrated x*f(x) and I'm confident that is correct, but I'm confused about how to ...
0
votes
0answers
16 views

glmer with gamma distribution - problem fitting model

I am trying to fit the gamma distribution to my data as the residuals are not normally distributed but it has been much more difficult than I anticipated. The dependent variable is response times and ...
0
votes
1answer
30 views

Estimating and testing correlation of longitudinal random variables

Each patient (indexed by $i$) contains multiple measurements of two variables $X_{i,t}$ and $Y_{i,t}$ over time $t=1, \dots, T$. For each time point $t'$, assume the correlation $\mathrm{cor}(X_{i,t'},...
1
vote
0answers
9 views

Some Confusions Regarding Variable Importance Extraction of Several Machine Learning Models

I'm trying to apply several machine learning algorithms in R using caret (decision trees, ensemble methods (bagging, boosting, ...
0
votes
0answers
15 views

Comparing tiff files in R statistically [closed]

I have two rasters (one is modelled and other is observed) each showing mean of Gross Primary Productivity for the years 2000-2010. I would like to know what is the best approach to statistically ...
0
votes
0answers
12 views
0
votes
0answers
7 views

What test of statistical significance does RClimDex use?

I'm using the ETCCDI recomended software for calculating the 27 Climate Change Indices. The software is called RClimDex 1.0 and it also gives you the trend of each index and its statistical ...
0
votes
0answers
14 views

How is the kurtosis on the Cullen and Frey graph in the R package fitsidtrplus calculated?

I am using the package fitdistrplus in R to fit distributions to my data. My first step was to check my data against the Cullen and Frey graph that is produced using the descdist function. This is ...
3
votes
1answer
31 views

Why use a dummy instead of dropping observations in regression?

In my regressions I analyse subgroups of people, i.e. thresholds for certain continuous variables. I am interested in changes at these high values. I was told that it is beneficial to not drop ...
0
votes
0answers
14 views

PCoA/MDS on sqrt transformed Bray-Curtis dissmilarity using cmdscale

I would like to use PCoA to visualize beta diversity of a large community. I chose Bray-Curtis as distance measure to calculate the dissimilarity matrix and would like to apply a square root ...
0
votes
0answers
14 views

Dxy and c-index in weighted cox regression using cph

I am using coxph() of the survival package and cph() of the ...
0
votes
0answers
16 views
0
votes
1answer
15 views

Transforming means/averages into percentages/relative numbers

The question might be simply, but I am still a bit confused, so any help would be much appreciated. I am working with a table that looks similar to the following, where I have the base-revenue "...
0
votes
1answer
16 views

How to deal with positive slope vs. deteriorating present data when using rlm in R?

I have a data frame "customers" build of customer id, month and total purchases that month. I have calculated a running slope of total purchases (window of 12 months) for each customer. The ...
0
votes
1answer
11 views

Eigenvalues from `prcomp`

I used prcomp to calculate the follow PCA values: ...
0
votes
1answer
15 views
1
vote
0answers
15 views

Does the nnetar function from the forecast library in R allow for backpropagation? [closed]

I think I am confused about how the nnetar function works in R. Does it apply backpropagation to feed-foward network or does it perform another operation involving simulation ? How does it train on ...
1
vote
0answers
11 views

Creating a synthetic control with pooled cross-sectional data

Is there a way to create a synthetic control using pooled cross-sectional data, rather than a panel? I'm analyzing a staggered reform and, so far, the methods I've found require having a panel: Ben-...
0
votes
0answers
16 views

Converting Cohen's $F^2$ to Cohen's $D$

How can I convert Cohen's $F^2$ to Cohen's $D$? I am interested in calculating the effect size for the difference between two groups in a mixed model. The data is from a within-subjects experiment ...
0
votes
0answers
15 views

R plot() Function Producing Boxplots Instead of Scatterplot [closed]

I am trying to create a scatterplot for some discrete data I have. However, when I use the plot() function in R, the program is creating boxplots instead of a scatterplot, most likely because some of ...
0
votes
1answer
30 views

Why is the Spearman or other type of correlation in R is unable to produce p values on only two datapoints?

Why is the Spearman or other type of correlation in R is unable to produce p values on only two data points? I would like to do correlation with only two observations and produce p vlues of ...
0
votes
0answers
6 views

Do I need to backtransform the estimates of a model produced with the mhurdle package using box-cox normal distribution?

I am currently running a double hurdle model with the R command "mhurdle". My data is not normally distributed and I am using the box cox normal distribution on because that yields the ...
-1
votes
0answers
14 views

Is there any R package similar to 'ivreg2' in Stata? [closed]

The ivreg2 is helpful for instrumental variables estimations in stata when there is a dynamic panel data model. But is there a similar R package as well to do this? Also for dynamic data model.
0
votes
0answers
10 views

Error: coef/vcov not consistent with basis matrix

I am trying to understand predictions from distributed lag no linear models. I use trial data from R and I run a glm model with crossbasis matrix from DLNM package. When I am trying to get the ...
0
votes
1answer
15 views

What is the meaning of “lag” in Box.test (Ljung-Box test)

I want to conduct the Ljung-Box test on residuals of the ARIMA model with Box.test(e, type = "Ljung-Box", fitdf = degrees_of_freedom) where N = 3064, ...
4
votes
1answer
35 views

Parsimonious Mixed Models

I recently read a paper on the trimming of random effect structure by Bates, Kliegle, Vasishth and Baayen (2015). My understanding is that the Parsimonious Mixed Model they proposed mainly follows the ...
1
vote
0answers
31 views

How to normalize data in R

This is my data: ...
2
votes
1answer
29 views

Can I reduce fixed factors when there is convergence failure in glmer

In my glmer model, there are four variables treated as fixed effects: A (categorical, 2 levels), B (categorical, 3 level), ...
0
votes
0answers
6 views

LOOCV with robust linear discriminant analysis in R

The MASS:lda() R function for linear discriminant analysis implements both classical and robust versions of LDA. But I noticed that the argument for leave-one-out ...
4
votes
1answer
33 views

How do I interpret this hurdle model summary (pscl)?

A little bit about my data: I have four treatment groups: control, early, late, both. For each group, I counted nymphs and eggs on leaves on five different dates. The design is randomized complete ...
0
votes
0answers
52 views

Obtaining Standard Error of an estimate knowing its likelihood function (in R)

Suppose I know that the likelihood function for an estimate of effect size (called dppc) measuring the change in a control group from pre-test to post-test in ...
0
votes
0answers
20 views

How to predict a distribution from another distribution using neural network [closed]

I collected test scores of math and physics of my students every year over the last 20 years. Math score distribution looks different from physics distribution; neither follows any particular ...
2
votes
0answers
30 views

Analyze misclassifications

I've trained a classification model (XGBoost) but I'm having some issues with misclassification (especially false positive). I want to analyze the misclassified observations to see if the model misses ...
1
vote
0answers
10 views

Center ggplot2 output image around x-axis label [closed]

The plot below shows some data I collected. It was plotted and saved using ggplot2: ...
1
vote
0answers
14 views

SECR AIC compatibility

I'm a student in ecology and I'm currently doing an internship to validate the first year of my master degree in France. I have to calculate roe deer density for the Mavrovo National Park in Macedonia ...

1
2 3 4 5
467