Questions tagged [r]

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

Filter by
Sorted by
Tagged with
0 votes
0 answers
453 views

Regression measurement error - Classic Errors in Variables assumption - command in R

I need to handle measurement error in independent variables. I have the CEV case i.e. that $$CoV(x_1^*, e_1) = 0$$ where $x_1^* = ability$ (a persons innate ability) and $x_1 = sat$ (a test score). ...
user1603548's user avatar
-1 votes
1 answer
43k views

How to display multiple variables in a boxplot with R [closed]

I am not very strong with R, and I am having some issues displaying a boxplot. I am not looking to use additional packages (such as ggplot) - I am trying to do this through just the R core. I have a ...
user3784030's user avatar
1 vote
0 answers
148 views

When sample size is large, can I get away with 10 bootstrap resamples? [duplicate]

The ggplot2 package in R includes a dataset called diamonds. The dataset can be accessed by loading ...
luciano's user avatar
  • 14.3k
2 votes
1 answer
298 views

Understanding the physical meaning of a plot of a Random Forest model

When experimenting with Random Forest, I plot the Random Forest model as follows. How should I understand the generated figure? What does each line correspond to, and how to extract the corresponding ...
user3269's user avatar
  • 5,162
8 votes
2 answers
15k views

What does the "1" in the R formula "y ~ 1" mean?

I am trying to understand the code written in the following discussion (see link): ...
I Like to Code's user avatar
8 votes
3 answers
4k views

Prediction Intervals with Heteroscedasticity

I am using R to perform linear regression. I have seen ways to calculate prediction intervals, but these depend on homoscedastic data. Is there a way to calculate prediction intervals with ...
Andy's user avatar
  • 83
7 votes
1 answer
5k views

Relative importance of variables in Cox regression

I've understood that relative importance of predictors is a tricky question. Suggested methods range from very complex models to very simple variable transformations. I've understood that the ...
Adam Robinsson's user avatar
0 votes
1 answer
126 views

Which number should I use for In-between group analysis by using Fisher's exact test?

I have to find out if the baseline demographics have statistically significant difference between two groups. The project is about two groups of students, one intervention group and one control group. ...
user90978's user avatar
3 votes
1 answer
1k views

How can I properly forecast sales with skewed data?

I'm using model trees to forecast sales data. I've developed a pretty good model but I'm concerned about some of the models predictions. I'm working with R and using the M5P algo in the RWeka package. ...
Bob's user avatar
  • 143
4 votes
1 answer
876 views

What is $\mu_i$ in a GLM / link function

Is it so that: $y_i$ is not a discrete value, but a range with probability density function Which means for the same predictor(s) value $y_i$ could have different results In linear regression this ...
n_mu_sigma's user avatar
  • 1,101
1 vote
1 answer
517 views

What is the best Deep Learning Library in R? [closed]

I am looking for a complete deep learning library in R. I am trying to find one or more libraries to implement: Recurrent NN Deep Belief NN Convolutional NN I have tried multiple libraries such as ...
vagelis's user avatar
  • 135
2 votes
1 answer
4k views

How to weight data according to multiple variables

I have two datasets. Dataset A is considered the population. It has 7 variables with different number of classes / breaks for each. Dataset B is the dataset I want to make look like Dataset A in ...
Claire's user avatar
  • 21
1 vote
1 answer
489 views

Three stage nested design with one replicate runs out of degrees of freedom

I am trying to use a three stage nested design to do an analysis on incomes for different households. The data can be visualized as follows: ...
Darth's user avatar
  • 11
0 votes
0 answers
1k views

Reproducing the cox model score test in R

I am using R and would like to recreate by hand the values of the tests. For example, ...
RayVelcoro's user avatar
  • 1,179
0 votes
1 answer
448 views

Binary Data with Count Dependent Variable?

Howdy internet strangers! I've put a sample of my data below, but basically I have the number of accidental falls in a particular set of patients vs. drugs that the patients were taking. The drugs ...
Gabe A's user avatar
  • 1
6 votes
2 answers
3k views

calculating aggregate confidence intervals for forecasts

I'm using ARIMA models to estimate sales forecast for a company. The company's sales channel is broken down into 4 sales channels and I'm running 4 different models to estimate the sales for each ...
Saif's user avatar
  • 61
1 vote
1 answer
293 views

Spatstat package and Spatial point process: How to estimate the density when computing the inhomogeneous K-function?

http://www.inside-r.org/packages/cran/spatstat/docs/Kinhom Here we see that to get the inhomogeneous K-function, we can either use a kernel density approximation method with small bandwidth to ...
nobody's user avatar
  • 601
18 votes
2 answers
22k views

Formula for 95% confidence interval for $R^2$

I googled and searched on stats.stackexchange but I cannot find the formula to calculate a 95% confidence interval for an $R^2$ value for a linear regression. Can anyone provide it? Even better, let'...
luciano's user avatar
  • 14.3k
-1 votes
1 answer
933 views

Help with improveProb function in Hmisc in R

Please bear with me, I am very new to R. My question is regarding the use of the improveProb function in the Hmisc package. I ...
kirsada's user avatar
11 votes
2 answers
20k views

Why does the intercept column in model.matrix replace the first factor?

I'm trying to convert my factor column to dummy variables: ...
digitgopher's user avatar
1 vote
0 answers
330 views

Quadratic equation system solving analytically or numerically

I have such a nonlinear equation system $x_i=\frac{\sum_{j\neq i}a_{ij}\times\sum_{k\neq i}x_k}{\sum_{k\neq i}x_k-\sum_{j\neq i}a_{ij}}$ where $a_{ij}$s are known coefficients in $[0,1]$. And $x_i$s ...
user3813057's user avatar
  • 1,092
6 votes
1 answer
1k views

Alternatives to stepwise regression for generalized linear mixed models

Are there any easy to use alternatives to stepwise variable selection for GLMMs? I have seen implementations of e.g. LASSO for linear regression, but so far not seen anything for mixed models. Mixed ...
Rob Hall's user avatar
  • 1,292
3 votes
1 answer
2k views

Difference between `mle` and `optimize` functions in R

I am trying some examples in R about maximum likelihood estimation, and it seems that we can use both the optimize function of the "stats" package and the ...
Victor's user avatar
  • 6,565
-1 votes
1 answer
3k views

dtw(distance.only = TRUE, ...) : No warping path exists that is allowed by costraints [closed]

Using the UCR time-series database and modification in this code: ...
Mona Jalal's user avatar
6 votes
3 answers
98k views

calculating regression sum of square in R

Here is sample data: ...
John 's user avatar
  • 2,258
2 votes
1 answer
874 views

Making a residuals plot in R after anti-logging a predicted variable

I want to predict $y$, but I can only predict $\log_{10} y$. So in R I do fit <- lm(log10(y) ~ x) Now I want to know how well I've done with respect to my ...
rhombidodecahedron's user avatar
0 votes
1 answer
62 views

ARIMA modelling in R: Help please [closed]

I'm in need of some help in using R (bit of a newbie). If I use the following code in R arima(adj.close,order=c(2,2,3)) it will fit an ARIMA(2,2,3) model to <...
James's user avatar
  • 77
1 vote
0 answers
1k views

Supervised Binning with Naive Bayes

Context. I am working on a model to predict "churn". Subscription service where users pay a monthly fee to access the service. We would like to predict which accounts are likely to cancel or "churn". ...
Doug Fir's user avatar
  • 1,568
61 votes
1 answer
32k views

How to apply standardization/normalization to train- and testset if prediction is the goal?

Do I transform all my data or folds (if CV is applied) at the same time? e.g. (allData - mean(allData)) / sd(allData) Do I transform trainset and testset ...
DerTom's user avatar
  • 807
6 votes
1 answer
427 views

Adjusting time-series before a sudden increase(the reason & time of the increase are known)

There are 2 increases in magnitude (one between feb and march, and one at the beginning of september) (the chart has daily resolution btw) Assuming weekly seasonality, is it ok to get the exact ...
wsdookadr's user avatar
  • 181
0 votes
1 answer
183 views

R: Parsing multiple values into a single field [closed]

I have multi-class classification dataset with data saved in the form. [number, ..., number],number,number... ,number \n The numbers inside brackets are the labels and have varying length. Numbers ...
Joonatan Samuel's user avatar
2 votes
1 answer
3k views

Error within the dependent variable while running a RM ANOVA using ezANOVA

I'm having a problem running a repeated-measures ANOVA in R using the ezANOVA function. I have data from 20 subjects - each subject participated in 2 conditions and 2 laps (80 total data points in a ...
A.L's user avatar
  • 21
6 votes
2 answers
7k views

How to interpret slope parameter estimates for linear models in R?

I wish to analyse a simple lab experiment. I have 8 fish. Four are fed on diet A, and four on diet B. I measure their Nitrogen (N) over 5 time periods (so 5 repeated measures per fish). I wish to know ...
user2890989's user avatar
2 votes
1 answer
483 views

Meta-analysis of correlated responses using metafor package

I would like to perform a meta-analysis on data gathered from multiple studies. Assume that the data contains multiple correlated outcomes of interest, but that not all studies have the outcome in ...
ruser45381's user avatar
4 votes
1 answer
14k views

Ways to test accuracy of auto.arima in R

I have around 10000 time series showing one particular metric over 5 hours. I used auto.arima function In my previous question, people suggested that I have to use auto.arima for each time series, ...
user2961712's user avatar
2 votes
0 answers
244 views

Prediction intervals for levels using a VAR model in second differences

Given a VAR model for the second differences of a vector time series, $\Delta^2 y$, how to obtain the one-step-ahead (and possibly $h$-step-ahead) prediction intervals for the series in levels, $y$? ...
AlanKinene's user avatar
1 vote
0 answers
1k views

How to split dataset for Time Series Data using caret package for R

I have a dataset of many predictors including Individual and Year. If I understand how the caret package works for creating folds, it randomly splits the dataset irrespective of variables. The years ...
CooperBuckeye05's user avatar
3 votes
0 answers
73 views

Reconciling wildly different $\chi^2$ independence test results (bootstrap clustering)

I have some data that should be randomly assigned to treatment $T$, and am running some tests on observables to give evidence that this is indeed the case. Let's focus on an outcome I'll call $X$, ...
MichaelChirico's user avatar
0 votes
1 answer
5k views

Error in sample. Incorrect number of probabilities [closed]

...
States.the.Obvious's user avatar
1 vote
0 answers
110 views

Goodness of forecast in time series

I used two different methods to forecast a time series data. The first one used is HoltWinters with Beta and Gamma as FALSE, since I don't see any trend or seasonality in the plot. Below is the ...
Ashish Anand's user avatar
5 votes
1 answer
5k views

cv.glmnet Ridge Regression lambda.min = lambda.1se?

I'm currently running a ridge regression in R using the glmnet package, however, I recently ran into a new problem and was hoping for some help in interpreting my ...
dwm8's user avatar
  • 283
4 votes
0 answers
12k views

K-Means Clustering with Dummy Variables

I want to use k-means to cluster my data. I have broken one column into 4 dummy variables and I have normalized all of the data to mean=0 and sd=1. Will k-means work with these dummy variables? I ...
Adam12344's user avatar
  • 527
0 votes
1 answer
73 views

Advice on predicting continuous dependent variable

My challenge: maximize $R^2$ on an out of sample data set. Constraints: Continuous dependent variable with negative values Over 150 variables with no information about them Some of these ...
PDog's user avatar
  • 31
3 votes
1 answer
1k views

Standard error of the intercept in orthogonal regression

I want to perform a univariate regression but with substantial measurement error in both $x$ and $y$. I therefore want to try orthogonal regression with R. The best answer to my question so far have ...
user90622's user avatar
1 vote
0 answers
170 views

Different model output in Mac and PC

I have been working on my PC to analyse my multilevel data. I am now working on a Mac and have run the same model. Some of the output is the same but some is quite different. I can't seem to work out ...
keelybebbington's user avatar
2 votes
0 answers
289 views

How to statistically determining a suitable sample size when population SD is unknown

I have a data set which contains data about mobile phone testing. They inspect the phones for their quality (health effects for people) and give a score between 0 and 100 (0 being unhealthy for usage ...
SriniShine's user avatar
4 votes
3 answers
33k views

Computing the Standard Error of the Estimate from the ANOVA table

My question is quite straightforward, but I did not find a clear answer anywhere. I'm computing the Standard Error of the Estimate (SEE) by doing the square root of the Residuals Mean Square output ...
Gonzalo Sánchez's user avatar
1 vote
1 answer
1k views

Goodness of forecast in R (Time Series)

I used two different methods to forecast a time series data. The first one used is HoltWinters with Beta and Gamma as FALSE, since I don't see any trend or seasonality in the plot. Below is the ...
Ashish Anand's user avatar
3 votes
1 answer
1k views

Simulating the game of bingo using a Monte Carlo approach. Is this methodology correct?

A while ago while talking with a friend, he said a friend of his goes to play bingo in order to win money. I told him that this is not possible because his friend is going to lose in the long run, ...
mickkk's user avatar
  • 939
0 votes
1 answer
672 views

Shapiro test only checks non-normality?

I am a bit confused regarding the Shapiro (and Anderson-Darling) test. I have 2 datasets with about 100 columns each and would like to perform a t-test between columns (meaning column 1 in dataset 1 ...
PrincessJellyfish's user avatar

1
405 406
407
408 409
596