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
2 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 ...
3
votes
2answers
342 views

Empirical Likelihood estimation in R

I'm new to Empirical Likelihood Estimation. I'm trying to find an example of how to find the empirical likelihood estimate of a univariate mean $\mu$ using the ...
1
vote
1answer
178 views

Constants in a DLM Model R

Good afternoon, I am attempting to fit a state space model of the form: $$ (S_t- \mu) = G*(S_{t-1} - \mu) + E_t $$ $$ Y = F*S_t + v_t $$ Where $Y$ is nx1, $G$ is 3x3, $S_t$ is 3x1, $\mu$ is 3x1, and ...
3
votes
3answers
205 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
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 ...
2
votes
1answer
278 views

Using MatchIt to match groups in a retrospective analysis

I am interested in using the R package MatchIt to preprocess my data as to obtain matched groups based on a predefined treatment variable. However I am facing a few issues. The first issue is that ...
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
24 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
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
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 ...
1
vote
2answers
56 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 ...
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
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
132 views

Chow Structural Test in R

I am sitting on a pile of data concerning wages at a local company and other information, such as the gender, whether the person in question belongs to a minority group etc. What I would like to ...
1
vote
1answer
134 views

AUC and Balanced accuracy in R Modelling

Can someone please explain the difference between AUC(Area under curve) and balanced accuracy in R? For eg: In decision tree modelling I got the, AUC : 0.91 balanced accuracy : 0.72 please explain ...
4
votes
2answers
524 views

Clustering of points based on vector feature similarities in R

I have as an input a number of points that I need to partition into clusters. Each point has a number of features that are ideally to be used to find the similarity between each point and the others. ...
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
1answer
155 views
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
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 ...
0
votes
1answer
84 views

Method to identify the point in which the slope of a predicted probability becomes significant

I'm running a logistic regression in which I'm predicted a binary response from a continuous predictor... I'm interested in determining the exact point in which the predicted probability ...
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
1answer
16 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 ...
3
votes
1answer
29 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 ...
1
vote
1answer
422 views

Error term/Innovation process in ARCH/GARCH processes?

I am wondering about the distribution of the error term/innovation process in a ARCH/GARCH process and its implementation, I am not sure about some points. The basic assumption is ...
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
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
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 ...
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 ...
1
vote
1answer
123 views

Understanding forecast horizon for Diebold-Mariano tests

I have a problem understanding the parameter horizon of the function dm.test {forecast} in my particular setting. Background: My goal is to forecast energy consumption for individual households. The ...
2
votes
2answers
501 views

Computing confidence intervals for population variance from a sample in R

Is there a package available for R (on CRAN, github, r-forge, etc.) that computes CIs for the population variance, given a sample of data, 95% CI parameter, etc.? The ...
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")) ...
1
vote
1answer
30 views

RandomForest MeanDecreaseAccuracy interpretation

I know there are already some questions regarding the interpretation of the MeanDecreaseAccuracy metric of the randomForest-package, but it's still unclear to me. My assumption was that each variable ...
2
votes
2answers
1k views

How to obtain AIC with conditional logistic regression using R?

I am fitting a conditional logistic regression model with 1:4 controls using R. I wish to obtain AIC from the model. How can I ...
3
votes
2answers
127 views

Equation of a fitted smooth spline and its analytical derivative

I need to fit a spline function to a data set. I tried with bs, ns and smooth.spline. In my ...
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 ...
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 ...
2
votes
2answers
517 views

Changepoints in R

I have the following dataset: ...
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, ...
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 ...
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 ...
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 ...
8
votes
1answer
2k views

Non-linear mixed effects regression in R

Surprisingly, I was unable to find an answer to the following question using Google: I have some biological data from several individuals that show a roughly sigmoid growth behaviour in time. Thus, I ...
0
votes
0answers
60 views

glmer warning message in r

I have a data set of 2430 observations, with a binomial dependent variable, 3 categorical fixed effects and 2 categorical random effects (item and subject). I want to to a mixed effects model using ...
1
vote
1answer
45 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 ...
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 ...
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 ...