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
3 views

reweighting one time series using proportions computed from another as weights in r

i have two groups of time series data about employment in two industries in two states. i need to figure out how to reweight one of the series for one of the states (for both industries) using ...
0
votes
0answers
7 views

How to correctly address “ALERT: Iterations finished, maximum likelihood not found” in poLCA?

I intend to use Latent Class Analysis on a large dataset with 12 response categories and approximately 50,000 observations. I am getting an "ALERT: Iterations finished, maximum likelihood not ...
1
vote
1answer
19 views

How to obtain histograms of non-central t distributions from a normal distribution?

My Question; I'd like to know how to generate random numbers that follows a non-central t distribution using the normal random numbers. I made a calculation code for this using R (See Box2, below), ...
0
votes
0answers
6 views

How to interpret the results from three simple linear regressions side by side whit the export_summs() function

I ran a 3 simple linear regression of the percentage of votes pct_votes on three variables : share of immigrants akapct_immigrant...
1
vote
0answers
25 views

What methods can I use to quantify the impact of multiple variables on a response variable?

Suppose I have observations for both the predictors ${x_1,x_2,...,x_p}$ and the response $y$, what I am interested in is the controls of these predictors on the response $y$. There are several cases ...
0
votes
0answers
5 views

How to use joint models to assess the unique contribution of change in a longitudinal variable, incremental to current levels of that variable?

I am hoping to use joint modelling (shared random effects models using JM) to test whether change in a longitudinal marker variable contributes to prediction of a survival event, incremental to ...
0
votes
1answer
15 views

How do you test for a “moderator” with ANOVA?

I am trying to understand the terminology, and the appropriate test. What is the difference between a moderator, and just another factor, with ANOVA? The first factor is a consumer's market confidence ...
0
votes
0answers
3 views

Comparison of variances with multiple factors using fligner kileen test

Hope my question fits in here and I have described everything well enough. Somehow I cant quite get my head around it. I have a data set with pesticide residue data in flowers, which had been obtained ...
0
votes
0answers
4 views

Hotelling's-t random distribution in R [closed]

I would like to know if there is some R package to create a random Hotelling's-T distribution. Thanks!
1
vote
0answers
17 views

Simulations of Chi-Square Tests on 2 x 2 table without using the chi-square distribution

I'd like to simulate the chi-square test without using the chi-square distribution on the following 2×2 table. I made "chiq_2by2" function using the R (See #main function in the Box1,below)....
0
votes
0answers
15 views

Cointegration/GPH test

I am quite new to R and statistics. I want to test two time series with the GPH test for cointegration. For this I use the package LongMemoryTS and the function gph:...
1
vote
1answer
7 views

Different results using randomForest::randomForest with one tree vs rpart

I am wondering what randomForest package handles differently for each individual tree. If I build a random forest with a single tree, no resampling, and allow the usage of all features in a dataset, I ...
1
vote
0answers
18 views

Using clmm() for ordinal dependent variables

I have a 2 (Complexity: 1=Simple vs. 2=Complex) by 3 (Type: 1=A vs. 2=B vs. 3=C) design, where each participant completed separate tasks counterbalanced across the 6 conditions, and then gave a rating ...
0
votes
0answers
3 views

Connecting the points of a dodged geom_point by group [migrated]

Consider this nested data set, in which i aim at plotting the two nested factor variables on the x-axis: ...
1
vote
0answers
3 views

Is a two-way repeated measures ANOVA an adequate design for this experiment?

I want to study if a continous variables called Value changes when measured by different combinations of Raters and Methods. Since the subjects are the same in all the combinations, is a two-way ...
-1
votes
0answers
11 views

selecting columns of a df for outlier analysis [duplicate]

I am running an outlier analysis using the package Routliers. I want to run analysis only including columns 2 and 3 in my analysis. I have multiple columns in my df. Here is sample data: ...
0
votes
0answers
10 views

How can I calculate with R a time-series mixed-model with random effects and a binomial dependent variable?

I'm evaluating a time series where users solve tasks in sessions. The model I want to evaluate is as follows: Main effects: Performance in single task (binomial) ~ workload + time on task Random ...
0
votes
0answers
11 views

Getting trip information from AVL data

I got a problem which needed to solved using Machine learning. The problem title is "how to generate trip information based on AVL". The dataset generated from AVL device is collected by ...
0
votes
0answers
21 views

limiting a df to specific columns for outlier analysis [closed]

I am running an outlier analysis using the package Routliers. I want to run analysis only including columns 2 and 3 in my analysis. I have multiple columns in my df. Here is sample data: ...
0
votes
0answers
14 views

discrepancy calculating power of 1 sided 1 sample proportion test

I am running the R code below to compare two methods for finding the power for a one-sided (greater) test of a proportion versus a fixed value ie lower bound (ie one sample test) - I have sample size ...
0
votes
0answers
6 views

How to include phylogeny in GLMM (not community ecology)

I have a dataset derived from a multi-species experiment that I carried out. I have 30 different plant species from several families and 3 geographical groups. I applied 6 different treatments to 5 ...
1
vote
0answers
14 views

Generalize functional Autoregressive model

I am working with the multivariate hourly electricity price data, data consist of six years hourly electricity data in which the first five years are use as testing set and the last year as validation ...
-2
votes
0answers
15 views

How to calculate the standard deviation of a type in R [closed]

I read it in R and want to calculate the standard deviation of type "tumor" , how can I do that?
0
votes
0answers
17 views

Help Interpreting regression analysis of 2 models

I'm being asked to compare 2 data sets and their regression model outcomes, and pick one that is stronger to rely on for future regression analysis, and explain why. Here are the summaries of the 2 ...
0
votes
0answers
12 views

Number of Distinct Bootstrap Samples - A Non-Trivial Scenario

Michael Chernick's (@Michael R. Chernick) great book Bootstrap Methods with Applications to R explains that there are ${2n - 1}\choose{n - 1}$ distinct bootstrap samples. This comes from the fact that ...
4
votes
1answer
75 views

How to see Simpson's paradox effect via glm in R

I am using the UCBAdmissions dataset and glm from R to check for Simpson's paradox. I am ...
0
votes
0answers
17 views

Generating Poisson-Gamma data for empirical parameter estimation in r

I'm currently trying to learn parameter estimation and want to illustrate and compare different credibility methods (limited fluctuation, Bühlmann, Bühlmann-Straub) using both Bayesian and Empirical ...
3
votes
1answer
22 views

Random Forest Variable Importance Plot Discrepancy?

I am using the following code to get Random Forest variable importance plot: ...
0
votes
0answers
14 views

glmer r significant slope but bootstrap confidence interval includes zero

I am running a generalized linear mixed model in r using glmer. The slope (year) from the model is significant (<0.05), however, when I bootstrap the slope to get the confidence interval it ...
0
votes
0answers
11 views

Determining whether one variable is significantly different from multiple others in ggplot2

I have a dataset with the concentrations of six drugs for four diseases and eight participants ("Donors") in ±O2 conditions. I suspect that Donor 1 in my dataframe below might be an outlier ...
0
votes
1answer
4 views

failure to get survreg results- all NaN- Error in coxph.wtest

I was trying to run Interval regression but all I got was this error message Error in coxph.wtest(t(x) %% (wt * x), c((wt * eta + weights * deriv$dg) %% : NA/NaN/Inf in foreign function call (arg ...
-1
votes
1answer
19 views

R: Simulate data with interaction given Y and X

I want to simulate an independent variable $Z$ given a dependent variable $Y$ and an independent variable $X$. Specifically, I want to simulate data that fits the following model : $$Y=b_0+b_1 X+b_2 Z+...
0
votes
0answers
17 views

Regression - stratified parameterisation in R

Just had a question in regards to stratified parameterization in R. Suppose we have y ~ x*g, then we get the stratified parameterization by doing y ~ g/x. I just wanted to ask if y ~ g/x is itself a ...
0
votes
0answers
20 views

Transforming Logistic Regression Model

I have a Logistic Regression Model in R ...
0
votes
0answers
15 views

General question about oversampling with TSNE or PCA

I have an unbalanced dataset and I am planning to use over-sampling (resampling) and finally, I want to use PCA or TSNE for a better demonstration of the data (the data has more than 50 dimensions). I ...
1
vote
0answers
9 views

Appropriate model for classification problem with monthly observations for same customer

I'm looking for some help understanding what the appropriate method would be for the classification problem(well really I want the probabilities) at hand. The event that is being predicted is whether ...
0
votes
1answer
7 views

replicate weights for a special version of survey of consumer finances?

i am currently working with a special version of the SCF that is hosted by uc berkeley and i am experiencing an issue with it. https://sda.berkeley.edu/sdaweb/analysis/?dataset=scfcomb2019 the special ...
0
votes
0answers
7 views

How to control for variables in random forests (in R)?

I am using a set of life history traits and human impact factors (12 in total) to predict extinction Risk (binomial: threatend / non-threatened). My model is based on the default 'randomForest' ...
2
votes
1answer
41 views

Logistic Regression R

I am learning R. This is from the book "R for Everyone" by Jared Lander. I was learning logistic regression on some housing data. The code below came from the book: ...
0
votes
0answers
12 views

SEM model in Lavaan - information matrix could not be inverted

Can anyone tell me what is wrong with my model? R is saying that it may not be identified! This is what im running: ...
1
vote
0answers
18 views

Why do we not get an R squared value for the intercept only term? [duplicate]

When I try to fit an intercept only model in R, why do I need get an R squared? I can see from the formula of the adjusted R squared that this would be 0, but this isn't shown either.
0
votes
0answers
7 views

Plotting C5.0 tree in r [closed]

When running the following code i can't make my code plot the decision tree... when finding the summary it appears as if it solved the C5.0 correctly as the output is as expected, can anyone explain ...
0
votes
1answer
15 views

How to compute the left singular eigenvector matrix (U) from the output of prcomp() for PCA in R?

I am examining the output of the prcomp() function in R for PCA in light of the singular value decomposition equation: $X = U \cdot \Sigma \cdot V^{T}$, where: $X$: ...
3
votes
1answer
39 views

Mixed model required?

I find the available (online, freely available) literature on linear mixed models to be comprehensive but utterly convoluted. Assume we have some longitudinal data. We have a dependent variable, $Y_{...
0
votes
0answers
5 views

Unused argument_Error in Overlap Estimates

I've been working on the Overlap package by Mike Meredith and Martin Ridout. While trying to determine first overlap estimates (in their example). ...
0
votes
1answer
16 views

How to estimate SEIR model parameter in R via RSS?

I tried to estimate the SEIR MODEL parameter in R by using the following code .Unfortunately I couldn't get it because I get the following error : "Error in names(parameters) <- c("...
2
votes
0answers
18 views

ARIMA (auto.arima in R) forecasts 0 for high variance and large time series

I'm noticing an issue with using auto.arima in R where if I input a series with large values and high variance, the forecast simply returns 0. Is this because the ...
0
votes
0answers
10 views

Which package works for mediation analysis in R when variables are categorical?

I am assessing pregnancy data where my exposure is categorical variable (either dichotomized or ordinal), potential mediator is categorical (dichotomized or ordinal) and the outcome is also ...
1
vote
1answer
14 views

Should I use the package “emmeans” for planned comparisons? Or should it be used only for post-hoc tests?

Because "emmeans" looks at all pairwise comparisons, I am asking myself if I should use the package for planned comparisons (I have hypotheses about the differences between certain groups). ...
-1
votes
0answers
9 views

How to manipulate Date variables for Month/Day [closed]

I'm having issues trying to figure out a way to change the format of the date in my data. My current date variables look like: ...

1
2 3 4 5
479