Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 1352

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

1 vote

How to predict a univariate time series with Elman neural networks in R

This, at least, is standard in R. For predicting, there is probably a predict.elman function, to which you will need to feed the values of the explanatory variable x. …
Stephan Kolassa's user avatar
2 votes
Accepted

Using `qnorm` in R

You can either subtract your probability from 1, or use lower.tail=FALSE. > pp <- 0.2 > qnorm(pp) [1] -0.8416212 > > pp <- 0.8 > qnorm(1-pp) [1] -0.8416212 > qnorm(pp,lower.tail=FALSE) [1] -0.841621 …
Stephan Kolassa's user avatar
1 vote

Adding a value to each element of a column in R

R vectorizes operations (here: addition) automatically. > c(1,2,3,4,5)+5 [1] 6 7 8 9 10 (Such questions are better at StackOverflow in the R tag.) …
Stephan Kolassa's user avatar
1 vote

How do I save the vector n into a file called <02_exercises_vector3.txt> such that each lett...

For instance, using cat with the file parameter: > n <- letters[1:10] > n [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" > cat(n,file="foo.txt",sep="\n") Look at ?cat.
Stephan Kolassa's user avatar
1 vote
Accepted

R datatable weekday not defined because of singularities

Then R will take care of all dummy encoding automatically. …
Stephan Kolassa's user avatar
1 vote

How to find out the regions a classifier performs well in machine learning?

Take a large amount of testing data, enough to cover a meaningful amount of your IV space. Apply your classifier to the testing data. Evaluate it, using your favorite error measure. Use a regression …
Stephan Kolassa's user avatar
3 votes

Identify the original variable used to calculate the dummies

If you can perfectly reconstruct the dummies from a candidate predictor, then the dummies and the predictor carry the same information. If the dummies encode intervals of the predictor (the most commo …
Stephan Kolassa's user avatar
1 vote

How to fit El Nino SST data (as an exogenous data) in ARIMA modeling in R

Yes, you can do that. If you simply feed the data into xreg, then Arima() will fit a regression on your predictor with ARIMA errors. (This is not an ARIMAX model. See here.) I would recommend that yo …
Stephan Kolassa's user avatar
3 votes

What is the correct way to interpret a $95\%$ confidence interval from the t.test function i...

Your "general understanding" is precisely correct. Each one of your infinitely many experiments will give rise to a separate confidence interval for the parameter of interest (here: the difference in …
Stephan Kolassa's user avatar
1 vote
Accepted

calculate p-values based on an arbitrary distribution

In R, use ecdf(): > xx <- rnorm(100) > ecdf(xx)(2) [1] 0.99 To get a p-value, you will need to do some judicious subtraction from one, taking absolute values and/or division by or multiplication by …
Stephan Kolassa's user avatar
1 vote

How to predict values up to two weeks ahead?

Both are available in the forecast package for R. If you do not expect multiple seasonalities, you could try standard forecasting algorithms, like exponential smoothing (forecast::ets()). … I recommend the excellent free online book Forecasting: Principles and Practice (2nd ed.) by Athanasopoulos & Hyndman, which uses R throughout. …
Stephan Kolassa's user avatar
2 votes

Reporting zero inflated negative binomial regression in APA style

I don't have the APA Publication Manual at hand, but I don't think there is anything specific for a negbin regression in there. I would report it in a similar way to a correlation coefficient. For ins …
Stephan Kolassa's user avatar
5 votes
Accepted

Optimization failure in HoltWinters

The internal optimization in HoltWinters() ran into a numerical problem. That happens. I suggest you try ets() from the forecast package, which will also fit exponential smoothing models, albeit in a …
Stephan Kolassa's user avatar
1 vote
Accepted

Normality of sequence

You are looking at two completely unrelated things. Yes, looking at the normal density evaluated at 1, ..., 100 (and matched for mean and variance) will look normal, because it is. But to assess wheth …
Stephan Kolassa's user avatar
2 votes
Accepted

why does ggplot show outliers but no whiskers?

Note that the middle boxplot does show upper and lower whiskers. Note that whiskers extend from the box to specific values, namely, for the upper whisker, "the largest value no further than 1.5 * IQR …
Stephan Kolassa's user avatar

1
2 3 4 5
26
15 30 50 per page