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

learn more… | top users | synonyms

0
votes
1answer
7 views

Have I correctly specified the lmer model?

a simple two-level model, with one explanatory variable at the individual level (X) and one explanatory variable at the group level (Z): ...
0
votes
0answers
7 views

Comparing means of different training programs in R

I have a data set with performance and training data that looks something like (this is not the exact data, but gives a general idea): ...
0
votes
0answers
4 views

stacked polynomial regression vs polynomial in the Xi

The Ramsey RESET (Regression Equation Specification Error Test) can tell if the model is under specified. The test can suggest that polynomial regression may be in order. ...
0
votes
0answers
12 views

Wold type cross validation of PCA model

I need to write (school exercise) an R code of the Wold type "k-fold" cross validation of PCA models in order to determine the sufficient number of principal component based on the original article of ...
0
votes
0answers
11 views

Compare three non linear regression lines

I'm beginning to explore the world of the non-linear models and I'm needing to compare if there are significant differences between the slopes of three different groups. I have been reading some ...
0
votes
0answers
6 views

Calculating effect sizes for mixed effect logistic regression to determine subsequent sample size

We conducted a previous preliminary study using 40 participants. We analyzed the data using the lme4 package in R to conduct a mixed effect logistic regression. We ...
0
votes
0answers
7 views

Error terms and random effects standard deviation in multilevel modeling with R

While interpreting random effects part of the multilevel modeling with R, are standard deviations the same as error terms? For example, when the result is Random effects: Groups Name ...
0
votes
0answers
16 views

How to use lagged outcome variable in CausalImpact?

I would like to use the lagged outcome variable as regressor in the CausalImpact/bsts package. Since I cannot use the ...
1
vote
0answers
25 views

JAGS model: Error in node - Failure to calculate log density [on hold]

I would like to estimate a system in JAGS (Just Another Gibbs Sampler), using RJAGS. I encounter the following error: ...
0
votes
1answer
35 views

Selecting the best GLM (generalized linear model)

GLM (family=binomial) is foucusd on when the response is dichotomous(yes/no, male/female, etc..). I'm wondering how to judge if the model we built is good eough? As we know, in OLS regression some ...
0
votes
0answers
14 views

Simulate data around existing data in r

I have been working at this for sometime, surfing StackExchange and any other R webpage I can find without any luck. I am trying to simulate data to essentially recreate the attached figure with ...
0
votes
0answers
6 views

Multiple tests, summary of clogit

I have 10 exposure variables that i would like to analyze univariate. I've applied the conditional logistic regression model for each exposure and then used the summary function for each one of them. ...
0
votes
1answer
24 views

Using predict with PCR in R

I'm trying to follow the documentation on the pcr method in R So I do the following ...
1
vote
0answers
12 views

Encode special values in continous predictors

I have continuous variable with missing values. Missing values are of different types (indicated by special values such as 991, 992). How do I best encode my data for logistic regression? I can create ...
0
votes
0answers
12 views

How to specify a multi-instrument 2SLS [migrated]

I'm looking for a compact way to specify a multi-instrument 2SLS in R. Imagine that there are four treatment categories (A, B, C, and D). There are two waves of measurement, Y_1 and Y_2. A ...
0
votes
0answers
8 views

The `Shepard` function in R package `MASS`

The function Shepard is listed in the help file for MASS::isoMDS, but nothing is said about it. What does this function do?
0
votes
1answer
21 views

Cramer Von Mises - How to use this test correctly?

I had a problem when I tried to test the fitting of my data with the generalized Pareto distribution. I used the MLE to estimate the two parameters 'shape' and 'scale' and I generated a vector of ...
0
votes
0answers
11 views

How to Find the Correlation in Time Series of Categorical Variables in R?

I have a data set of categorical variables occurring weekly. A sample dataset can be found in my previous post. I want to check the co-existence of these categorical variables over time. I want to ...
3
votes
3answers
208 views

Interesting Logistic Regression Idea - Problem: Data not currently in 0/1 form. Any solutions?

I am attempting to conduct a logistic regression for a tennis analytics project, endeavoring to predict the probability of a player winning a point in which he is the server. My response variable ...
0
votes
0answers
20 views

How to plot quantile regression with LASSO in R? [on hold]

Good day! Please help me with plotting quantile regression with LASSO in R. Here are the codes I used. library(rqPen) y<- read.csv("C:\Users\book1.csv", header=F, col.name=c("WD")) ...
0
votes
0answers
23 views

what does the scale within a PCA mean

I am searching for an explanation what the x and y axis within a PCA analysis really means? I could not find any explanation on this topic, can somebody help me with it? So, just as an example ...
0
votes
0answers
27 views

When removing outlier is right? Removing techniques for outliers in R [duplicate]

I was searching outlier removal in R and I saw some comments related to almost never you should remove outlier from dataset. I wonder when we should remove outlier? I have a dataset consisting ...
0
votes
1answer
42 views

Multiple regression - High adjusted R^2 but the residuals are high

I used the multiple regression models to derive the outcomes after using AIC pairwise comparison and deleted the outliers, high leverage points. And it seems good, the adjusted R^2 acheived 0.9543, ...
1
vote
0answers
15 views

Removing outliers based on cook's distance in R Language

I have this R code for linear regression: fit <- lm(target ~ age+sales+income, data = new) How to identify influential observations based upon cook's distance ...
0
votes
0answers
14 views

Logistic regression in R, basing on which class(0 or 1) in dependent variable the modelling is performed

In R and in binomial logistic regression to be specific, the modelling is based on which class amongst 0 and 1? And if it builds model based on 1 by default, is there a parameter or something in which ...
0
votes
0answers
26 views

Logistic regression in R, basing on which class(0 or 1) in dependent variable the modelling is performed [on hold]

In R and in binomial logistic regression to be specific, is the modelling done based on which class amongst 0 and 1? And if it builds model based on 1 by default then is there a parameter or something ...
3
votes
1answer
30 views

why bootstrap result in overfitting for randomForest prediction?

I am dealing with an imbalanced dataset with the R package randomForest. Some one has suggested that, Bootstrap your data while over-sampling the rare class and under-sampling the typical class. But I ...
0
votes
1answer
24 views

R Matrix correlation non-numeric

Dear More Advanced that I R users, I am having a problem creating and interpreting some data. Here we go with the question and please let me know which parts are not clear. I have some data that I ...
0
votes
1answer
17 views

reshape data with repeated and alternating column names [on hold]

I am a beginner with R, and I would like if someone can walk me through this issue. I have a data set with three variable x, y, z and many rows. The variables repeat every year in columns for 45 ...
1
vote
1answer
22 views

How does the R function arima() calculate its residuals?

I am new to time series and I am trying to figure out exactly what does on beyond the scenes in R. Say I have the MA process: $$y_t - \mu = a_t+\theta_1 a_{t-1} + \theta_2 a_{t-2}$$ where $a_t$ are ...
0
votes
1answer
18 views

RStudio RMarkdown PDF generation has bug / flaw with R Projects [on hold]

This is something that had confused me for a while. I figured it out, then ran into the same problem again, so I wanted to be sure to post it to help out others. As RStudio has become more robust ...
0
votes
1answer
26 views

Python/R Exploratory Data Analysis for Classification

Are there preexisting functions in Python/R that create exploratory data analysis plots like the following:
1
vote
1answer
30 views

On estimating ARIMA models on artificially made time series data

For each day, I observe my variable, y(t), for a period of 12 hours. In order to understand the data and make predictions, I want to put together these data and ...
0
votes
0answers
10 views

Multiple categorical and continuous variables in ANCOVA

I have performed an experiment where insects in a certain order were captured and identified at set distances from a forest boundary. At each point I have measured a number of environmental variables ...
0
votes
0answers
11 views

How to precompute foldid with even observations per fold for glmnet [migrated]

According to the glmnet vignette, a foldid can be set up by: foldid=sample(1:10,size=length(y),replace=TRUE) However, if you ...
0
votes
0answers
29 views

Power Calculations in R for ANOVA's

I need to use R code to calculate the power of a Nested ANOVA. I want to detect a 3% difference between two consecutive tests between a stage in a process. The tests are identical and material has ...
0
votes
0answers
21 views

Power calculations in R [duplicate]

I need to use R code to calculate the power of a Nested ANOVA. I want to detect a 3% difference between two consecutive tests between a stage in a process. The tests are identical and material has ...
1
vote
1answer
41 views

Find a best fit curve for a function f(x) = g(x+1)/g(x)-g(x+1)

I have a set of noisy data that can be described by a functional form. For each observation f(x), where x is an index that runs from 0-100, I know that f(x)=g(x+1)/g(x)-g(x+1). I would like to find a ...
2
votes
0answers
19 views

Time-dependent coxph output and making predictions in R

I'm trying to use a Cox proportional hazard model to predict the time until an employee terminates from an organization. There are a bunch of covariates (~20), some of them time-dependent. So I've ...
1
vote
0answers
15 views

Correlation between different types of variables

I am running a logistic regression on a data set containing Continuous, Ordinal, Categorical and Dichotomic variables. I would like to know how to calculate the correlation for all possible ...
1
vote
2answers
57 views

How to constrain cumulative Gaussian parameters so that the function will intersect one given point?

I am analyzing data from one study where participants had to choose (between two stimuli) the one with higher intensity. One way to look at the data is to fit the proportion of correct choices as a ...
0
votes
0answers
15 views

Error in ezANOVA [on hold]

I do a lot of mixed ANOVA (both within and between subjects factors) and have found the ez package very helpful for this. However, lately, it seems to have stopped ...
0
votes
1answer
35 views

Logistic regression is appropriate? Forecasting player’s serve point win % as a binary variable, w/ both numeric and categorical independent variables

I effectively want to model the probability of a player winning his service point (a point in which he is the server) based on the values of explanatory variables (namely court surface and opponent ...
3
votes
0answers
38 views

Formatting R output to mimic Stata or SPSS or SAS output [on hold]

It has been my experience that different academic fields have converged to different statistical software apps as their "standard." E.g., in Economics Stata is very common but virtually unheard of in ...
0
votes
0answers
18 views

What methods can I use to estimate the uncertainty when a subset of rows are removed from a dataset?

Apologies if I misuse some terminology here, I'm learning as I go along. I have a dataset with a set of descriptors and flags. There are around 60000 rows, but the flags are fairly sparse (covering ...
1
vote
0answers
16 views

Error message in diagnostic plots of GLM in R

I created a generalised linear model in R: mod10 <- glm(RRBEE ~ SNH3000 + PAG1000 + SR250 + C250 + HE250, data = data1, family = poisson) I ...
0
votes
0answers
17 views

ARIMA versus a Mixed model for trend detection

I am trying to find any evidence of warming in monthly times series data of water temperature over a 21-year period that is serially correlated. Essentially I am looking to determine a global trend, ...
0
votes
1answer
16 views

Aggregating risk scores

I have a model which calculates the risk of default on several essentially independent metrics. These are default probabilities between 0 to 1. 1 implying a high risk of default. Now I wish to ...
2
votes
0answers
14 views

How to choose variables to include in ANCOVA

I have a data set that includes a DV (Richness or Abundance) and multiple continuous and categorical variables: ...
0
votes
0answers
18 views

how can I sampling by rows with partition? [on hold]

I have customer orders data,and I have defined a variable churned to specify who is churner and who is not churner,but there are big differences between the proportion of churner and nonchurner,so I ...