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

0
votes
0answers
5 views

Homoskedasticity of the residuals

When, I fit an ARMA model to data, I look at the standardized residuals plot to assess if they behaves like uncorrelated random variables with zero mean and costant variance (if the model is good). ...
0
votes
0answers
7 views

Is lmer or glmer appropriate for nested continuous proportion data

I have a reviewer that wants me to analyze my data along the lines: Con_Ratio ~ Range * Latitude * Longitude + (1 | Genotype/Pair). But I'm not sure if this can be done and how. My experimental ...
2
votes
1answer
6 views

How to conduct power analysis for unbalanced one-way ANOVA in R?

I am looking for a way to conduct power analysis for unbalanced one-way ANOVA in R. I found the pwd package; however, it only allows me to calculate power for ...
1
vote
1answer
23 views

Out-of bag error in Random Forest

I am trying to code my own, simple version od RandomForest function in R for learning purposes. However I have a hard time understanding the concept of the out-of-bag error. Is it simply done by ...
0
votes
0answers
24 views

Unable to remove heteroscadasticity

This is my model: lm(PCTUI~year+statefips+factor_agecat+factor_sexcat+factor_racecat+factor_iprcat, data = train) I have factorized the categorical variable. ...
0
votes
1answer
20 views

multiple one sample t.test with ANOVA

If I want to see if the mean of 3 different groups is above a specific threshold instead of doing 3 on-sample ttest can I use anova? So instead of 3 ...
0
votes
0answers
8 views

How to caluclate robust standard errors for a multinomial logistic regression (using the multinom command)?

I've estimated a multinomial logistic regression model using the nnet package and the multinom command. Now I would like to calculate robust standard errors for my coefficients but I don't know how to ...
0
votes
0answers
4 views

Questions about the interpretation of system-dynamic simulation in R

I try understand simulation modeling in R using DeSolved package. As source i used this article https://api.rpubs.com/rsmard05/sysDynR. It is detailed, but some things are incomprehensible to me from ...
0
votes
0answers
15 views

Experimental design for simulation experiment

I'm interested in investigating the effect of a treatment on survival times of a patient. The "patient" is a complex program with many interacting categorical and continuous variables. It also has a ...
0
votes
0answers
7 views

“right” in hist() function in R [on hold]

what is the meaning of "right" in hist() function in R while programming in R it makes significant changes in the graph Kindly answer me what is the utility of the right
0
votes
0answers
4 views

R shiny Error in as.vector: cannot coerce type 'closure' to vector of type 'character' [migrated]

I wonder if anyone can help me to figure out the following problem ...
0
votes
0answers
11 views

How to choose the best algorithm to fit neural model [on hold]

Im beginner in machine learning .. I have a problem of classification and i want to fit a neural network model with R and using the function Neuralnet(). but i don't know what is the best algorithm to ...
0
votes
0answers
22 views

What does the error of the neural network model mean? [on hold]

I m fiting a neural network model using R and with the library(neuralnet) but i found the error of the neural network model 500.222 that is not logical at all .. I got this Error when i wrote this ...
0
votes
0answers
10 views

Handling baseline differences with a retrospective study and mixed model

I am looking at the fixed effects of Var1, Var2, and Var3 on a dependent variable ...
0
votes
0answers
4 views

Change color of points on a plot based on index R [migrated]

I want to plot anomalies in a dataset with a different color. For that i generated random numbers, injected anomalies based on a condition, and them plotted them. But the plot that i am getting is ...
0
votes
1answer
19 views

Differences in calibration plots for machine learning models

I'm using machine learning methods in R for descriptive regression modelling of a small dataset. I have fit random forest (randomForest), unbiased random forest (cforest) and boosted regression trees (...
0
votes
0answers
13 views

Random coefficients logit estimation with Hierarchical Bayes in R

I am trying to estimate a Random Coefficients Logit model using the RSGHB R package. Thought, I came across with 2 main issues: Why the ...
1
vote
0answers
8 views

How to perform single-arm meta-analysis

I'm currently intending to perform a single-arm meta-analysis which study outcomes are: Objective Response Rate (ORR%), Disease Control Rate (DCR%), Duration of Response (DOR) in months, PFS in months,...
0
votes
0answers
24 views

Defining custom Bayesian priors in R (BayesFactor package)

I'm performing some Bayesian analyses in R using the BayesFactor package, and was wondering whether it is possible to specify priors for the alternative not centered on zero (the current defaults ...
0
votes
0answers
8 views

Three Factor Multiple Comparison Post-Hoc Test for Levene's Test

My research question is to find out whether or not my samples are exhibiting any significant differences in their variance in response to three possible treatments. Here are my possible groups: ...
0
votes
0answers
11 views

Variance inflation factors for time series

R code: I got an error by using vif function. ...
1
vote
0answers
14 views

summarisng sequences in R? [on hold]

I have a large data set comprising 45,000 days of a rainwater system switching between running on a tank or off the city water mains. The system switches between the two depending on the level in the ...
1
vote
1answer
32 views

How do you select the best from a number of linear models?

I'm learning linear regression with the Carseats data set. I went through the data, cleaned it, encoded the dummy variables and checked for collinearity. The dataset has 400 observations on Carseat ...
0
votes
0answers
24 views

bayesian decision making - comparing expected loss

The problem is like this: Suppose that I am considering which country should I invest on, country A and country B, based on their GDP growth rate $\alpha$. There are two possible choices for each ...
1
vote
0answers
18 views

Strange rugarch error: $ operator invalid for atomic vectors? [on hold]

So, I am trying to make a huge nested for loop (optimizations be left for later) to fit all of the GARCH models available from rugarch. This is my MLE that ...
0
votes
1answer
33 views

R: What's the right way to add an interaction term in lm()? [on hold]

I'm working with the Carseats data. I'm making a model to predict the sales of Carseats and I'd like to make an interaction term with Price and Competitor Price. Is it as simple as ...
0
votes
0answers
11 views

Description of the Cotton data in R package agricolae [on hold]

I am trying to use the cotton data in the agricolae package in R but the package documentation does not provide enough description of the dataset especially details concerning the variables "lineage" ...
1
vote
1answer
20 views

using decision tree to describe high dimensional data

I have a dataset with 6 numeric columns and one dichotomous factor contain yes and no. I would like to understand when yes is more likely given the 6 numeric columns. I intend to use a decision tree (...
2
votes
0answers
16 views

Interpreting the estimate of an ordered factor in regression

I have an output from a lm() object that has ordered factors. ...
0
votes
1answer
27 views

Lag regression independent variables in dynamic panel: which Explanation of the signs? [Resolved]

In the famous paper " Richard Blundell & Stephen Bond (2000): GMM Estimation with persistent panel data: an application to production functions, Econometric Reviews, 19:3, 321-34" the authors ...
0
votes
0answers
12 views

VineCopula package conditional probability

Suppose I have 3 variables, $U_1, U_2, U_3$. Suppose further that I fit R or CVine copula. Then, to find the conditional probability $U_1 \leq u_1|U_2=u_2,U_3=u_3$, the package suggests using ...
0
votes
0answers
18 views

System of equations for quadratic programming with inequality constraints [on hold]

Through the problem can be written for GLMs as well as for other more complex settings in terms of objective function and constraints, for easy of presentation, I present the problem using a simple ...
1
vote
0answers
13 views

Performing random forest on spatio-temporal rasters

We are trying to train a random forest model on land-use and meteorological variables to predict daily concentrations of air pollution at a 1km resolution. Our input data consists of 1km raster stacks ...
1
vote
1answer
32 views

Why doesn't the zero model in a hurdle model exactly match logit result?

I am relatively new to R and I suspect that there is user error here, but I cannot figure out why the output from the logit in the hurdle model does not match the prediction of the "zero" function in ...
0
votes
1answer
41 views

Running XGBoost with *highly* imbalanced data returns near 0% true positive rate. Tried SMOTE and it did not improve much. What else can I do?

I'm using XGBoost on a dataset of ~2.8M records of hard drive failures, where less than 200 are tagged as failures. After cleaning, there are 11 features in this dataset. Below is my ...
2
votes
0answers
7 views

GLMM - Aleatory effects in R [on hold]

I have a question if you could help me? I studied during 2 days (48 hours), 8 times per day (every 3 hours), 3 nests per species (2 species), the number of ants every 3 min that walk by a point. I ...
1
vote
1answer
19 views

Random effect in GAM - what are the smooth functions used?

In the GAM package in R created by Simon Wood there is a selection of the smooth function basis. I sort of understand the options such as bs='tp', bs='cr', etc. But bs='re' seems odd... that does ...
0
votes
0answers
12 views

How to tabulate by a certain subgroup with wtd.table? [on hold]

I'm analyzing survey data with R (with which I'm an absolute beginner) and want to tabulate a variable for a specific subgroup. I can't use the simple table command because I have a survey weight that ...
1
vote
1answer
53 views

Multiple hypothesis testing in R vs. Stata [on hold]

I'm trying to replicate Stata multiple hypothesis testing for SE clustered regression. Below I attach both Stata code and R code: ...
0
votes
0answers
9 views

Lorenz Curve for Insurance Pure Premium

I'm testing various pure premium models and want to make a Lorenz curve to compare the models. The goal is to show underwriters which models are better. I'm not sure if I'm doing it correctly. I'm ...
2
votes
0answers
34 views

Data obfuscation strategies that keep statistical properties intact

I am getting data from a provider that contains identifiable information from a number of different organizations. The data aren't particularly sensitive, but to be safe, the provider wants to perform ...
0
votes
0answers
10 views

Parallelizing BMA in R [on hold]

I'm using the following code to estimate a a Bayesian Model Averaging: ...
0
votes
0answers
9 views

Install packages on RStudio on a Linux server via a proxy [on hold]

I am trying to install packages on RStudio hosted on a Linux server, but when I use the command install.packages("dplyr") I get the following error, "Warning in install.packages : unable to access ...
0
votes
1answer
20 views

Problem with Tuckey correction for planned contrasts with emmeans and pairs() in R

I tried to post my question in Stack Overflow but they suggest me to ask to the statistic expert (you), so here I am! I have a mixed design with 1 between factor (Group: ASD, CTR) and three within ...
0
votes
0answers
18 views

What is the consequence from building polynomial regression with multiple ind. variables?

I'm exploring polynomial regression. I understand how to execute it for cases with one independent variable. What about cases with multiple independent variables? I'm working with the boston housing ...
0
votes
1answer
6 views

Is the R package Multivariate Imputation by Chained Equations suitable to fill in repeated measures survey data?

I am dealing with a dataset that contains demographic covariates (constant across time) and dummy variables for subjects for six repeated measures in wide format. I.e. a row represents a single ...
0
votes
0answers
10 views

Comparing the output and fit of an OLS and a Tobit model, and comparing Tobit models

I am trying to estimate a quite complicated model (many variables with different structures), with a limited dependent variable, which ranges from 0-100% with about 45% of the sample having an ...
0
votes
0answers
32 views

How do I use principal components as predictors in linear regression?

I followed the instructions from this open Stanford lecture on PCR. I have a couple of questions, but first I'll post the code with my comments. ...
2
votes
3answers
46 views

Mixed-model ANCOVA using nlme in R: How do I interpret and report significant interaction effects?

I've got a significant interaction effect and I'm unsure how to interpret and report the results. In my experiment, I've got plants planted inside fences to protect them from deer (fence plots) and ...
0
votes
1answer
33 views

What are the diagnostic measures for linear regressions?

I am working with the BostonHousing dataset. I have created a number of models and I'd like to select amongst them. ...