Search Results
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 |
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`.
2
votes
Accepted
Data splitting for train and test set
If you have enough evidence to believe that the patterns in 2020 and 2021 data are different (i.e: they're not just two samples of the same population), then you should not expect the same model to wo …
0
votes
Regression/classification models and dummy variables
Assuming you're using the base R lm/glm functions:
If you createthe dummy variables yourself, the step process will treat them as separate variables, so you may get some of them removed while the others … You can also feed them into the model as categorical and R will do the dummification for you. …
1
vote
1
answer
1k
views
Calculating AIC for a linear regression model
I'm seeing some "inconsistencies" on how R calculates the Akaike Information Criterion (AIC) for linear regression models. I'd like to get its expression so I can calculate it myself. …
1
vote
What is the contribution of base variables to principal components (PCA) after rotation?
The idea of principal component analysis is to transform your original variables into new uncorrelated or "perpendicular" ones. So if your original variables were already pretty much uncorrelated, it …
0
votes
How to calculate the midpoint between 2 latitude and longitude coordinates in R?
Does this one do the job?
mid_point <- function(long1, lat1, long2, lat2) {
if(abs(long1-long2 < 180)) {
long <- (long1+long2)/2
} else {
long <- 180 + (long1+long2)/2
}
if(long > 18 …
0
votes
Accepted
logistic regression log odds to probability issue in R
Those two results are exactly the same: zero! Try to see if the problem persists when using a more "normal" number, i.e: predict(logitMod, testdata[1]) in a range like $(-2,2)$ or $(-3, 3)$
1
vote
Comparing two groups with unequal sizes?
Welcome to Cross Validated!
Actually, there is no reason why you shouldn't perform a mean comparison test. Equal sample size and varaince are not a requirement.
You may want to check this to see how …
0
votes
derivative from regression model in R
You can do it on R but you'll have to write the code yourself (there's no explicit method for the lm class that will do it for you) If your model is
$Y:=\beta_0+\beta_1a+\beta_2b+\beta_3ab+\beta_4a^2+\ … beta_5b^2+\epsilon$, then:
$\frac{\delta Y}{\delta a} = \beta_1 + b\beta_3 +2a\beta_4$
R will provide the $\beta_k$ coefficients with coefficients(R2), returning a numeric. …
1
vote
Developing a 40-100 scoring system (doesn't work as intended)
With a mean of about 62 and an sd about 8, you already get too many over-90 scores. With a mean of 70 and sd of 10, you will always get even more!
The main problem you are facing is that your data is …
1
vote
Understanding cov.reduce argument in emmeans function
Please remember this is a statistics site, not a code one. However, a quick look at the emmeans documentation package reveals the following:
Using cov.reduce
cov.reduce may be a function, logical va …
3
votes
how to interpret a glm output in r
It would be good to first understand the output of the simpler linear regression model (your glm is just an adaptation of that model to a classification problem) Check my answer to this question Begin …
0
votes
Accepted
Interpreting qq plot from ARIMA residuals
My interpretation would be that the middle values of the sample are close to what you'd expect from normally distributed data, as it follows the straight line from the diagram closely.
However, it se …
1
vote
Using a given polynomial formula in a lm() model in R
That final peak is due to overfitting. Your model is way too complex for the data you are trying to fit. It is just finding the degree-4 polynomial that intersects the x value you have at the mean of …
1
vote
Check statistical significance of one observation
With only 1 observation, it is quite easy. Look how many standard deviations out of the mean your new data point is (this is, subtract the "data" mean and divide by the "data" standard deviation)
Now …
1
vote
Accepted
Making predictions in Logistic regression in R
You can relabel your classes as 1 and 0 or TRUE and FALSE, now the model will do it the way you expect.
If those are not the labels, well, I would try to guess it. You can try to see the prediction f …