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

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

I used the miltiple 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, ...
0
votes
0answers
11 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
19 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 ...
0
votes
0answers
11 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
15 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
0answers
16 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
14 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
12 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
0answers
16 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
24 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
16 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
34 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
15 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
1 view

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 ...
0
votes
0answers
8 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
25 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 ...
0
votes
0answers
6 views

modeling time series with seasonal and trend component with GAM in mgcv

I am trying to fit a statistical model to time series data in R. Specifically, I'm trying to remove the seasonal and trend components of my time series so that I can perform further analysis with the ...
1
vote
0answers
15 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
14 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
15 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
13 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
16 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
22 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
18 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
10 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
21 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
27 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 ...
1
vote
0answers
13 views

Visualizing multi-class ROC analysis [duplicate]

I am running a multinomial logistic regression model (with 3 possible outcomes) in R. I am trying to find the best way to assess the predictive power/accuracy of the model, and the best thing I've ...
0
votes
1answer
12 views

Bivariate K function for inhomogeneous spatial point processes

I have some inhomogeneous spatial point patterns of individuals in a cactus population. I also have marks, such as "diseased"x "healthy" individuals, and "adult" x "juvenile". I've already computed ...
0
votes
0answers
25 views

FORECASTING AR(1) Autoregressive Form

Ive been implementing a little exercise to obtain the first 2 forecasting points of an AR(1) process. And i want to have the forecasting ponts using the three forms: Im folowing this pdf ...
0
votes
0answers
16 views

How ARIMAX model is presented in R

I have a relatively simple problem, but yet taking some time to solve it. I am suing ARIMAX{TSA} function. This is the model ...
0
votes
0answers
13 views

How to fix dim(X) error in MICE (R)? [on hold]

I am trying to compute multiple imputation using the MICE package in R. I am working with a large scale study which includes 38 countries. For most countries I get reasonable results, but for some I ...
1
vote
1answer
40 views

rpart classification: why is my predict() output not adhering to type=“class”?

I have a dataframe, 'datas', with 200 observations and a series of columns (some numeric, dummy, etc) and a binary class variable to be predicted that is called "bad_econ." I would like to get the ...
0
votes
0answers
8 views

How does unbiased cov.wt compute its value?

What is exactly the calculation used when calling cov.wt((faithful,c(1,2,3,4))$cov)? (Say the data faithful has 4 rows and 2 columns, coordinates x,y) I.e.: What ...
0
votes
0answers
18 views

Custom Tables: How does SPSS treat multi response sets differently from categorical vars?

I have come across an SPSS-specific scenario where I cannot understand how SPSS is calculating its proportions test results. The scenario only takes place when applying t-tests and z-tests on "SPSS ...
0
votes
0answers
17 views

Rejecting Null hypotesis with t-test: excluding the mean [on hold]

So the question is: can we reject that median can be larger than 900. doing t-test in R, which gives correct answer?: t.test(x, mu=900, alternative="greater") t.test(x, mu=900, alternative="less") ...
0
votes
1answer
24 views

Confusing results on kpss.test() for stationarity

I've got a dataset which clearly shows a trend. However, I want to assess wether this trend is deterministic or stochastic. If I understood it right, I would need to use differences if the trend is ...
1
vote
0answers
29 views

Statistical significance between group sums

How can we state that there is a significant difference between total amounts of donations of two sample groups in the following scenario. Control group A has donated lots of smaller denominations ...
2
votes
0answers
32 views

Power of a Interaction term in R

I have analysed a dataset with a linear regression model, including an interaction term between a binary variable and a continuous variable. The interaction was significant. Afterwards, I have fitted ...
0
votes
0answers
13 views

Are the data stationary or non-stationary and seasonality?

I want to use Arima model for forecasting wind speed.I plot my data. Then i plot ACF and PACF. I used ADF test and KPSS test and they said that data are stationary and doesnt need differencing but ...
0
votes
1answer
27 views

Could anyone help me check my gibbs sampling code? [on hold]

I am now trying to write a Gibbs Sampling code based on the posteriors from a paper "Bayesian Regularization via Graph Laplacian", writer: Fei Liu, et. When I run the code, it always show the error: ...
-1
votes
0answers
12 views

How do you combine data with multiple datasets? [migrated]

I'm having trouble combining a bunch of different data sets together. When I combine them, the variables v1, v2, and id combine into two separate columns where there's 3 different numbers per cell ...
0
votes
0answers
21 views

Instrumental variable analysis after (propensity) matching

I am trying to replicate the methods used in this paper by Paul Rosenbaum and colleagues (Near-Far matching). I have been studying the methods in the referenced papers by Michael Baoicchi. My work ...