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
1answer
24 views

How to simulate correlated GARCH using rmgarch package in R [closed]

I'd like to simulate a couple of simulated and correlated GARCH(1,1) using the R package rmgarch. I tried to do: ...
0
votes
0answers
21 views

Should i transfer linear model to quasi-poisson GLM model?

The response variable is FreeKick (the duaration for completing a freekick in football match,unit is second,double), and explanatory variables is Timing (the timing for the freekick tooking place,...
0
votes
0answers
9 views

Density based clustering of a single dataset

When you look at this data, you can clearly see 2 bands, one is dense and the other is sparse.All of the data belong to a single column. I want to separate the dataset into two- one containing the ...
0
votes
0answers
10 views

How to make a function use the value of .x instead of the string “.x” in the formula of the iterated glm function in R? [closed]

I do multiple glm using the walk function and would like to use individual models in the created list in cross-validation. The cv.glm function uses the formula from the glm object. Unfortunately, my ...
0
votes
1answer
27 views

Understanding plot for stats::predict

I created a time series for 15 years (in each year 123 days), and I created a forecast using stats::predict for the next 5 years. ...
1
vote
0answers
7 views

Univariate vs Multivariate LMER psuedo r-squares

I have a multivariate (three DV's) repeated measures (Three time points) linear mixed effects model that I ran. As apart of the model diagnostic I'm attempting to calculate the psuedo r-squared value ...
0
votes
0answers
8 views

reduced range and variance of the predicted variable in linear regression

I am using linear regression in R to predict the target using a single predictor. I observe reduced range and reduced variable of the predicted values compared to the original target. ...
0
votes
1answer
13 views

Seasonal and trend decomposition using loess

I have the following code for forecasting an intermittent seasonal time series with several zeroes in it. How do I assess the fit of the model on the training data? I just get the forecast with plot(...
0
votes
0answers
10 views

Interpreting mediation analysis output in r [closed]

Am needing to some direction in interpreting mediation output in r. The result for the analysis are below, with the same result reflected in both Quasi-Bayesian and Bootstrapping. Which leads to a ...
0
votes
0answers
22 views

In generalized additive models, how does B-spline handle testing data that are out of range

In GAM, a general approach is to use B-spline basis expansion to approximate the true nonparametric function. Usually the edge knots are chosen as the minimum and maximum of the training data (for ...
1
vote
0answers
10 views

rma.mv effect estimate using “zcor” [closed]

This question has been asked before on this thread: 'rma.mv' function output- fisher Z or raw correlation, but the only answer didn't answer the question. I’m using correlation coefficients ...
0
votes
0answers
34 views

Difference between “empirical” and “theoretical” explained variance in PCA

In prcomp library in R for instance, the "empirical" and "theoretical" explained variances for PCA are given by: ...
0
votes
0answers
10 views

replacing nas when 50% or more of the data is missing

I have to perform a linear regression on a dataset. However, I am having trouble figuring out what type of imputation I should do on the data because in some cases the majority of the the data is ...
1
vote
0answers
8 views

How to check exogenity of residuals in linear regression model

can you please give me some advice in testing exogenity of residuals ? I check the internet and it says a lot of test or other ways to prove or disapprove other assumptions, but I couldn't find any ...
0
votes
0answers
21 views

Remove yearly seasonality from monthly time series with periodogram (in R)

I have the number of jobs recorded monthly over a 10 year period, which according to my plot seems to repeat every year. I am unsure how to account for this cyclical behavior in my model. I am using ...
0
votes
0answers
15 views

Doubts with interpretation of ACF & PACF plots

I am new to Time Series and I have some doubts interpreting ACF & PACF plots. I have found the following cheat sheet (link to source: https://www.linkedin.com/pulse/reading-acf-pacf-plots-missing-...
0
votes
0answers
6 views

How to build a linear mixed effects model on continuous data without groups to evaluate predictor in R

I am trying to see if certain brain network measures (such as brain density, efficiency, and clustering) measured at baseline can be predictive of the cognitive decline rate in participants (cognitive ...
0
votes
1answer
26 views
+50

How to model the effect of 2 predictor variables in a paired linear regression model?

I have a dataset formed of Patient_ID, Lesion_ID, Treatment_Outcome, ...
0
votes
0answers
11 views

Multiple methods for clustering repeated measures

I want to cluster a dataset that consist of 10 continuous variables (serum markers) with 150 patients measured 3 times (baseline, post-intervention, follow-up). An intervention took place between ...
0
votes
0answers
17 views

HDI of MCMC with predictions in bayes linear model

I am struggeling to find a proper solution to the following task my professor gave us: Question from the worksheet: Predict using the remaining 143 rows. How many predictions land within the 50% ...
0
votes
0answers
19 views

How to graph multiple variables

I've been tasked with the challenge of creating ONE singular plot that entails a multitude of relevant given data. There is one dependent variable vs three independent continuous variables, an ...
1
vote
1answer
12 views

Simple preprocessing large columns set

I have a huge dataset about the effect of the drug on cancerous cell lines with a 17k column. I need to prepare a simple regression, but I don't know, how to pick the most important columns. I ...
1
vote
2answers
54 views

How to draw from conditional Weibull distribution

I would like to draw random numbers in R from a conditional Weibull distribution which is given by P(x<=t+T| x>T) = 1-(1-F(t+T))/(1-F(T)), where ...
0
votes
0answers
12 views

Errors on 'Profiling Confidence Interval' after Maximum Likelihood Estimation in R

I'm practicing a cancer treatment model using Maximum Likelihood Estimation with 'bbmle' packages in R. Step 1. I generated a virtual dataset ...
0
votes
1answer
12 views

post hoc test on multivariate repeated measures linear mixed effects model (lmer)

I'm running a multivariate linear mixed effects analysis on data with the following structure: Where: Participants are nested within group, Time is a pre-post-post repeated measurement. The repeated ...
0
votes
0answers
5 views

How to compute cooks distance on a Vector GLM (VGAM package) [closed]

wondering if there is an easy way to compute cooks distance for a VGLM from the VGAM package in R Thanks
0
votes
0answers
7 views

compare time series of different treatments (with pre- posttest data)

I'm having a bit of trouble analyzing some time series for my research project. I have 6 plots in a field, and each plot has 2 water content sensors that measure every 30 minutes. I collected data ...
0
votes
0answers
12 views

Error in gee.fit$working.correlation[1, 2] : subscript out of bounds [closed]

I have a dataframe in R that looks like the following ...
0
votes
0answers
9 views

Non-Significant T-tests but significant F-Test, even though my VIF is generally low

For my linear regression, I have response variable and two predictors. My second predictor is an interaction between the first predictor and a factor because I wanted to see how the predictor changes ...
0
votes
0answers
14 views

Custom frequency in fpp package [closed]

Here is my data, my_df <- data.frame(some_data = sample(1:100, 21, replace=T)) I would like to use this time series with ARIMA from ...
0
votes
0answers
18 views

In R, what is the difference between lm1$resid and resid(lm1)? [closed]

So, in working with some data and creating a simple linear model, I wanted to test that my model met the assumptions of linear regression. I started by looking at a Q-Q plot. I was chatting with a ...
0
votes
0answers
10 views

r-squared calculation for multivariate linear mixed effect model: lme4

I've built a multivariate linear mixed effect model with 3 dependent variables and a repeated measures factor. My data follows a hierarchical structure where participants are nested within groups. my ...
1
vote
0answers
6 views
0
votes
1answer
22 views

fitting specific formula/model in r - model possibly not identifiable

I would like to fit the following formula in R: y ~ alpha *(x1_0 * x2_0 * beta_0 + x1_1 * x2_1 * beta_1) Here: alpha, ...
1
vote
0answers
11 views

Mean covariate value in msm

I've been going through the manual of the R msm package for multi-state Markov models and have a question regarding how the default intensities are reported. The ...
1
vote
0answers
11 views

Spectral analysis in R, how to interpret periodogram

I'm relatively new to spectral analysis and have been working through some online tutorials. I have some time series data that I would like to examine for periodicity / repeating patterns. When I ...
0
votes
0answers
10 views

Average run length (ARLs) for Risk-adjusted Cusum [closed]

Please , i'm working on Risk-adjusted Cusum and i'm looking for R code that describes the simulation of ARLs (in-controle and out-controle ARL) for risk-adjusted Cusum (binary data) in order to ...
0
votes
0answers
8 views

Packages are not getting installed on R studio [closed]

While trying to install packages on R studio, it asks me to create my personal library. I am selecting yes but it is not working and if I select no, then it shows an error message. How can I solve ...
0
votes
1answer
17 views

error term in nlme::lme function

I cant seem to find this info anywhere. What do the different sides of the | in the lme or lmer (in lme4) functions represent? i.e.,: (1|ID) vs (Time|ID) ...
0
votes
0answers
14 views

Multivariate hierarchical linear model via nlme

I'm running a multivarialte repeated measures hierarchical linear model in r's nlme package. I have three dependent variables D1, D2, and D3. My variable structure is such that a time point is nested ...
0
votes
0answers
9 views

Ranked frequency distribution table — is same rank assigned for same frequencies?

Let's say I have a word frequency table with rankings, which I will be using to plot a Zipf distribution: ...
1
vote
1answer
22 views

R finding the inverse of the ecdf function [closed]

So I am calculating the percentiles of data in a data frame by using the ecdf function. Like this: dataFrame$percentiles <- ecdf(dataFrame$data)(dataFrame$data) ...
0
votes
0answers
31 views

Which test to use? Independent data or not?

What I have is a cross section of a bone divided in 60 equal slices. These 60 slices form 4 groups of 15 slices each corresponding to the 4 anatomical orientations (anterior, lateral, posterior and ...
1
vote
1answer
21 views

Does a threshold effect the training or testing fold in cross validation?

I am trying to better understand how changing a threshold affects a cross validation model. So if you trained a random forest model, the default threshold is ...
0
votes
0answers
18 views

selecting the right sample observations (not features!) from datamart with R [closed]

I have a datamart of 1 million rows and 50 columns. I want to select a smaller sample of 100 thousand rows (and 50 columns) 1.000.000 x 50 >> 100.000 x 50 (selecting a sample from data) But off ...
0
votes
1answer
22 views

Meaning of “Error in contr.treatment(n = 0L) : not enough degrees of freedom to define contrasts” when adding fixed effects to nlme?

We are attempting to model and compare logistic growth over time for 6 different treatments using nlme. So far, we have successfully added random effects of ...
0
votes
2answers
35 views

How to find similarity in R or Python? [closed]

I have a data set as I've shown below: It shows which book is sold by which shop. Also, every book_id has a type. ...
0
votes
0answers
11 views

SVM and Monte Carlo simulation to compute misclassification error rate

I am trying to solve the following problem with R: use simulation to evaluate (by Monte Carlo) the expected misclassification error rate given a particular generating model. Let yi be equally divided ...
0
votes
0answers
12 views

Circular regression with two circular regressors

I would like to test how well two circular regressors explain the variance of a circular response variable. One of the regressors consists of only two angles (either 0 or 180). Can anyone help me in ...
0
votes
0answers
18 views

Building glmer poisson with repeated measures with random effects and interaction

I have bird counts in three different landscape matrixes, repeated over two seasons. I want to evaluate if species richness differs between matrixes, accounting for seasonal changes. I am not very ...