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

Effect of “parameters.to.save” in R2jags/ JAGS

I'm using the package R2jags in R, which uses the parameters.to.save argument to specify parameters. I'm interested in the statistical distinction between a ...
0
votes
0answers
6 views

Restarting Lag based on Change in Name in Different Column

I am trying to insert lags of a variable into a separate column in my data frame on R. However, I want the lags to 'restart' every time the name in a different column changes. An example of data is ...
1
vote
2answers
16 views

Use of log, scale and center in PCA

Im following a tutorial here: http://www.r-bloggers.com/computing-and-visualizing-pca-in-r/ to gain a better understanding of PCA. The tutorial uses the following dataset: ...
0
votes
0answers
12 views

Density forecasting

I am having some troubles obtaining density forecasts of any returns series. As I couldn't find any numerical examples on the Internet, I would like to ask you guys for some help. My goal is to ...
0
votes
0answers
9 views

What is VectorSource and VCorpus in 'tm' (Text Mining) package in R

I'm not quite sure what exactly VectorSource and VCorpus are in 'tm' package. The documentation is unclear on these, can anyone make me understand in simple terms?
0
votes
0answers
9 views

Non-parametric alternative to a mixed anova?

My data fails assumptions of variance - (norm dist is good though) - and I was wondering if anyone had a suggestion for an alternative to a mixed anova? Three repeated measures (Test 1, Test 2, Test ...
0
votes
1answer
23 views

Model selection for linear regression with categorical variables

I regressed the dependent variable Rating (numeric) on Judge which is categorical. The output of the first model is given at the end of the question. Only Judge John Foy and Linda Murphy came out to ...
0
votes
0answers
8 views

How to define smooth.terms in GAM?

I am new comer in GAM. I read into gam introduction but still confused below questions: 1) how to know which independent variable need to be smooth ? To make smooth terms, now I try with different ...
0
votes
0answers
12 views

How do I Forecast new Yts given new Xt's using a Dynamic Linear Model?

I am trying to forecast predict new observations of interest rates given new data using the DLM modeling framework. Essentially, my problem is this: I have a training set (a set of data i want to ...
1
vote
2answers
83 views

How to standardize the variables in R for regression analysis

I have been looking at some tutorials and articles and couldn't get a scenario where two variables are in different scales and used in modeling. So, firstly lets assume I have one metric of numeric ...
1
vote
0answers
12 views

plot.gam versus visreg

I am trying to understand the difference between the two plots I see in the code below. Looking at the visreg manual pg 2 correctly and if the same applies to gam models, then visreg plots residuals, ...
3
votes
1answer
19 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
15 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
6 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
14 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
7 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 ...
0
votes
1answer
40 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
17 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
29 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
23 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
12 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
210 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
21 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
25 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
56 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
16 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
33 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
24 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
29 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
31 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
30 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
16 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 ...