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

Simulating a simple queueing problem to calculate $\Pr(B > 4).$ If-statement not working as I expect it

I have the following problem: Consider an M/M/3/4 queuing system with $\lambda=\mu=1$ that is the arrival time is exponentially distributed with parameter $\lambda = 1$ and the service times are ...
1
vote
0answers
15 views

Difficulty in understanding how to include covariates in random forest for timeseries data

I read this tutorial on how to use random forest for forecasting using timeseries data ( https://petolau.github.io/Ensemble-of-trees-for-forecasting-time-series/ ), and I have some difficulties to ...
0
votes
0answers
32 views

Calculate forecast Arimax model step by step

I am making a model in R, Arima and I want to replicate the forecast in excel, but at the time of doing it I cannot continue due to the MA. this is just an example data to understand how the R ...
1
vote
1answer
23 views

Which test to run … probit or logistic?

IV's: categorical School, categorical Grade Level, categorical Living Arrangement, categorical Race, categorical Illness, continuous Time. DV: withdrawn status (withdrawn or not withdrawn) I want to ...
0
votes
0answers
27 views

I am doing a Survival Analysis, using R on patients survival in an intensive care. What is the correct procedure for data preparation?

I have collected, and still am, data on survival in an intensive care. In essence, I have collected demographics, say, age, gender etc, and length of stay in the Unit, and outcome, namely died or ...
1
vote
0answers
19 views

T-test and tree don't match logically

I would like some help in a machine learning homework. First I want to make clear that I don't think this is considered cheating as I am just asking for help in understanding a result, rather than ...
0
votes
0answers
11 views

Is there any sense of applying cross validation to quasibinomial variable?

We can apply without any doubts cross validation for linear models as well as for binary models. For linear models for example we can output RMSE and MAE and Accuracy for binary models. But I have ...
0
votes
0answers
9 views

NLS more consistent than GMM

I'm trying a simple code to test whether NLS has better performance than GMM. The R code looks like this ...
1
vote
0answers
11 views

insignificant gamma1 parameter in EGARCH(2,1) model in rugarch package in R. By default? [closed]

I have built an ARMA(2,2)-EGARCH(2,1) model in R using the ugarchspec function from the rugarch package. The model is very good ...
2
votes
0answers
32 views

Correcting for robust/clustered standard errors within the lm function or replacing the results

Cross posted on Stackoverflow with a bounty of 200. EDIT: I think I have to clarify this question a little bit more. So what I am looking for, is a function in which I can provide both the vcov matrix ...
0
votes
0answers
16 views

Post-hoc tests for lmer for two and three-way interactions performing ANOVA type III

In R, I am trying to perform post-hoc tests on a significant three-way interaction involving two 2-level factors (bodymanipulation, soa) and a continuous variable (prosthesis_partofbody). The model I ...
0
votes
0answers
4 views

Imputation method for weather data

I have weather data (time series) which has variables like rainfall, air temperature, relative humidity etc. About 6% of the total records are missing (2191 total records). After data cleaning, what I ...
2
votes
0answers
28 views

Roughness penalty matrix for the Fourier basis functions

I am trying to understand how the roughness penalty matrix for the Fourier basis functions is calculated in R using the fda ...
3
votes
2answers
42 views

Interpretation of Cubic Spline Coefficients in R

I am using the titanic_train data set in R to build a logistic regression model. ...
2
votes
1answer
36 views

Variance of the Product of Correlated Random Variables?

I would like to multiply two correlated random variables, but I'm getting a negative variance. Please point out where I'm wrong. Variable1 and ...
0
votes
0answers
10 views

gam.check - k value is too small?

I'm trying out generalized additive mixed-effects models (GAMMs) in R with 3 continuous variables and 3 random effects. I'm using the gamm function in the R package 'mgcv'. When I run the function gam....
0
votes
0answers
40 views

statistical process control for non normal time series

Let us say I have several KPI measurements per month. There may be different numbers of measurements per month but there are more than 30. The monthly distributions do not look normally as shown in ...
1
vote
1answer
20 views

Lewbel (1997)'s Higher Moments IV Approach for Multiplicative Model

I wonder how I can introduce Lewbel (1997)'s higher moments IV approach in a multiplicative / log-log model. Assume the following linear model: We know that e.g. $Y_t=5+1 X_{1t}+1 X_{2t}+1X_{3t}+\...
1
vote
1answer
33 views

Is the proportional hazards assumption violated (interpreting Schoenfeld residuals)? What is my best option if so?

I am using an extension of the Cox model in the counting process format (Andersen-Gill model), with time-dependent covariates. The analysis is investigating the effect of an intervention on hospital ...
0
votes
0answers
6 views

Does the number of topics change based on the type of model?

I am working on a classification of some tweets regarding biomasses. I have made a classification with LDA using 75 topics (found by using the ldatuning library). Everything went alright, topics were ...
0
votes
0answers
12 views

Differing AAPC and Confidence Intervals Using the Joinpoint Regression Trend Analysis Software vs R

Let's say I have a data-set with trend data looking at an adjusted rate by year from 1980-2000, with a standard error associated with it: ...
0
votes
0answers
14 views

Different results summary() and anova() for glmer()

I am running a glmer model to see whether reaction times can be predicted by two categorical variables (i.e., task and condition) and their interaction (i.e., task:condition). task has 2 levels, ...
1
vote
1answer
28 views

Solution in case of violation of the linearity assumption in the logistic regression model? (possibly in R)

I have a problem with my logistic regression that I set up and I hope someone can help me. (I am working with R) My data is based on hourly values. The dependent variable is a dichotomous variable (1 ...
0
votes
0answers
8 views

Feature selection for machine learning question

I'm working with ML models and I need to train them with and without a previous feature selection (FS). The way I was doing was to get all my dataset and pass through a FS (in this case, filtering by ...
0
votes
0answers
6 views

How to reference other observations in a formula in R? [migrated]

I am trying to estimate the coefficient a in the following non-linear regression in R, using the non-linear least squares command: ...
0
votes
0answers
6 views

Decision between vcovPC and vcovPL (sandwich)

I want to do a linear probability model with clustered errors. The data also has a panel structure. In the R package “sandwich,” there are two functions: vcovPC() ...
0
votes
1answer
73 views

Which t-test it the right one for my data?

I have the data set below. Two Groups which were tested at 3 different timing. Between the tests, there were 5 weeks of training. I think, I should do the t-test for dependent variable. (I need ...
0
votes
0answers
12 views

Beta regression and post hoc test correct linear connectors?

I am trying to run a beta regression on my percent data which can be found here. My research question: How is percent cover changing in each transect over each event? Beta regression was choosen based ...
-1
votes
0answers
17 views

Can someone help with ARIMA [duplicate]

Can someone help me with forecasting? My forecast doesn't predict well, I tried to use Fourier but I am new to this so, can someone explain how to determine a good forecast? accounting for ...
8
votes
2answers
286 views

A challenging question of ANN

I ran into a challenge when see this solved old exam. As seen in this image the author select $(D)$ as the best option with minimum node. and in another page mentioned that if we use Bipolar then $(E)...
1
vote
1answer
20 views

Problem with a seemingly simple 2-way ANOVA

I want to test for the effects of two factors ('Habitat' and 'Population') on a continuous variable ('Trait'). I'm using R to call this seemingly simple 2-way ANOVA: ...
0
votes
0answers
4 views

Joint Test for Seasonal Forecasting Model using Dummy Variables

I recently created a seasonal dummy regression model in R given a dataset beginning Jan 2016 and ending May 2020. Given the results below there appears to be statistically significant seasonality in ...
0
votes
1answer
24 views

In r, when predicting with newdata=data.frame(1) what does it mean?

My here and now question relates to a weibul model with survreg, but my question is more general about r's predict(). Example: ...
0
votes
0answers
14 views

Two-tailed Wilcoxon rank sum test with false discovery rate corrections for multiple hypothesis in R

I have a dataset for a ML project and I need to perform the test described in the title. So I wrote this in R: ...
2
votes
1answer
14 views

Comparing 2 sets of different survival predictors

I have different predictors for survival data. How can I compare which predictor set would act as the better set? In other words, how can I compare ...
0
votes
1answer
22 views

Interpretation of GAMM with Factor level Predictors

I'm running the following model in R using the package mgcv: ...
1
vote
0answers
38 views

Manual calculation - instrumental variable with a tobit distribution in the 2nd stage, different results with robust errors

Cross Posted at Stack Exchange. I am trying to correct my standard errors, when using an ols distribution in the first stage and using a tobit distribution in the second. For some reason, I am getting ...
0
votes
0answers
20 views

Principal Component Analysis & Factor Analysis on Mixed Data Set

I'm currently doing work on a cars.data set, which was downloaded from Craigslist in the United States. First of all, there are a ton of outliers and generally, the data set is pretty subjective, as ...
0
votes
1answer
21 views

Predict values from complex Rjags model

It's the first time I'm working with R2Jags, MCM chains and Bayesian models and I'm having trouble to compute the predicted values for my model. The model is based on research by Hallmann et al. 2017, ...
0
votes
1answer
29 views

confidence interval for sample that is not normal distributed

I have one sample of only 86 values, which is not normally distributed according to the Shapiro-Wilk normality test. Can I still use this formula/code (sorry R code) to estimate the 95% confidence ...
0
votes
1answer
14 views

interval depending on sample size

I came across these funnel plots here and tried to reproduce something similar where I have a normally distributed population and I happen to know the true population mean (500000) and standard ...
0
votes
0answers
12 views

Correcting the standard errors, when the second stage is a tobit regression

I am trying to implement this bootstrap method for my data, but with more variables, to correct my standard errors (the original code is posted at the bottom). Cross-posted on Stackoverflow ...
-3
votes
0answers
23 views

ARIMA forecast (edited) [duplicate]

...
0
votes
0answers
9 views

Post-stratification based on population distribution of age and sex in the census using R

My data did not have any stratified sampling and is a simple random sample, so I used the following: data.svy.unweighted <- svydesign(ids=~1, data=dat) str(dat) tibble [2,924 × 101] (S3: tbl_df/...
0
votes
0answers
12 views

R: cannot find precision, recall and f-measured

I ran a logistic model, and want to know calculate precision, recall and f-measured from confusion matrix. Its accuracy is 0.995. ...
0
votes
0answers
12 views

estimaing OR from logistic regression with interaction in R

I am running a logistic regression with two explanatory variables x1 (0=No, 1=yes) and x2 (0=bad, 1=good), and the outcome y (0=alive, 1=dead). But I also want to test interaction between the two ...
0
votes
0answers
12 views

Should a mean of a sample unit be used in my generalized linear model?

I have a large data set with 520000 hours of detection data taken from 90 different sites, each hour representing the data collected within an hour bin. Our project compares detection rates using ...
0
votes
0answers
16 views

How to configure function “stl” to produce the same result as function “decompose”?

I'm doing prediction for a time series with function decompose. Unfortunately, the object returned by decompose is not ...
2
votes
2answers
19 views

Network clustering stability using bootstrapping techniques

I use the standard modularity-maximisation Louvain clustering method to partition a large undirected network into communities. I fear the result of the partition is quite fragile. Is there a standard ...
0
votes
0answers
19 views

Fit two logistic regressions for two groups separately and Compare them

I want to fit logistic regression with a binary response, and a continuous independent variable (e.g. Age). There are two groups of data, and I want to compare the models between the two groups to see ...

1
3 4
5
6 7
493