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
0answers
4 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
11 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 ...
0
votes
1answer
31 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
5 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
23 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
20 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
2answers
193 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
0answers
38 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
11 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
28 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
25 views

Python/R Exploratory Data Analysis for Classification

Are there preexisting functions in Python/R that create exploratory data analysis plots like the following:
0
votes
1answer
26 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
28 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
20 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
40 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
13 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
53 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 ...
0
votes
0answers
24 views

Running repeated cross-validation for multiple models using same dataset (caret package)

I'm currently using the train() function in the caret package to run 10-fold repeated cv on a random forest model. I would also like to explore other statistical and machine learning models for use ...
0
votes
0answers
20 views

Interpreting Sign of Mediation Analysis

I am new to mediation analysis. I am analyzing observational data, specifically, congressional races between 1980 and 2008. I am examining whether the effect of congressional partisan votes on an ...
1
vote
0answers
11 views

auto.arima and DLM give different values for loglikelihood

I want to estimate an ARIMA model on my timeseries, then represent it in state space format, mainly because it will be more responsive to change in pattern. I used ...
0
votes
0answers
22 views

Transforming data to standard normal

I have a residual expression matrix upon which I want to conduct an eQTL analysis using a linear model: I know that a normal distribution is required to use a linear model; my question is can I use ...
0
votes
0answers
28 views

Output from lmer in r

I am trying to evaluate the change in a variable si measured at different time points within individuals. Therefore using the time points (of which there are 3) as ...
-1
votes
1answer
35 views

Logistic Regression modeling in R

Consider this model: $Y_i$ ~ Bernoulli($\pi_i$) $X_i$ = 0,1 logit($\pi_i$) = $\lambda^{X_i}$ * $\beta_0$ This model simplifies to logit($\pi_i$) = $\beta_0$ , when $x_i=0$ , and logit($\pi_i$) = ...
0
votes
0answers
3 views

Does the cvglm function in boot package have arguments for mean centering and normalizing?

Does the cvglm function in boot package have arguments for mean centering and normalizing? If not, how can I run k-fold cross validation with mean centering and normalizing in R ?(especially for ...