Closed Molina-Valero closed 1 year ago
Hi @Molina-Valero,
I think we have fixed a similar issue some time back but am not sure.. Can you install the development version from GitHub and check if you still get the error?
# Install development version from GitHub
# install.packages("devtools")
devtools::install_github("rsquaredacademy/olsrr")
I will look into it if the error still persists after using the development version of the package.
Hi @aravindhebbali
Thank you for your help, but still have the same issue after installing the develpment version (0.6.0).
Sorry
No issues.. While I look into this, let me know if you can share the data. It will help in debugging the error.
Thank you! I am going to share the data later
Sure
Please install the develop branch of olsrr from GitHub for the fix:
# Install development version from GitHub
# install.packages("devtools")
devtools::install_github("rsquaredacademy/olsrr@develop")
# load library (development version)
library(olsrr)
# data
data <- read.csv('data.csv')
# model
model <- lm(W.ha ~ ., data = data)
# stepwise selection: use p_val instead of penter
ols_step_forward_p(model, p_val = 0.1)
Stepwise Summary
----------------------------------------------------------------------
Step Variable AIC SBC SBIC R2 Adj. R2
----------------------------------------------------------------------
0 Base Model 709.912 712.428 NA 0.00000 0.00000
1 p.b.mode.z 702.752 706.526 NA 0.29695 0.26766
2 var.r 698.076 703.108 NA 0.45616 0.40887
3 n.pts 694.380 700.671 NA 0.56314 0.50357
4 mode.rho 686.046 693.595 NA 0.70642 0.65050
----------------------------------------------------------------------
Final Model Output
------------------
Model Summary
---------------------------------------------------------------------------
R 0.840 RMSE 103103.928
R-Squared 0.706 MSE 13161472395.381
Adj. R-Squared 0.651 Coef. Var 17.008
Pred R-Squared -0.196 AIC 686.046
MAE 82828.714 SBC 693.595
---------------------------------------------------------------------------
RMSE: Root Mean Square Error
MSE: Mean Square Error
MAE: Mean Absolute Error
AIC: Akaike Information Criteria
SBC: Schwarz Bayesian Criteria
ANOVA
---------------------------------------------------------------------------------
Sum of
Squares DF Mean Square F Sig.
---------------------------------------------------------------------------------
Regression 665061288539.530 4 166265322134.883 12.633 0.0000
Residual 276390920302.999 21 13161472395.381
Total 941452208842.529 25
---------------------------------------------------------------------------------
Parameter Estimates
---------------------------------------------------------------------------------------------------------------
model Beta Std. Error Std. Beta t Sig lower upper
---------------------------------------------------------------------------------------------------------------
(Intercept) -18071950.603 5929827.602 -3.048 0.006 -30403702.181 -5740199.025
p.b.mode.z -9058.961 1636.669 -0.682 -5.535 0.000 -12462.601 -5655.321
var.r 6535.221 1995.734 0.390 3.275 0.004 2384.865 10685.577
n.pts 7.607 2.320 0.406 3.279 0.004 2.783 12.432
mode.rho 189752863.663 59272447.405 0.389 3.201 0.004 66489061.429 313016665.897
---------------------------------------------------------------------------------------------------------------
Hello,
Please, could you help me with the next issue?:
I am getting the next error using the function ols_step_forward_p:
Error in if (pvals[minp] <= penter) { : the condition has length > 1 In addition: Warning messages: 1: In anova.lm(fullmodel) : ANOVA F-tests on an essentially perfect fit are unreliable 2: In anova.lm(full_model) : ANOVA F-tests on an essentially perfect fit are unreliable 3: In anova.lm(full_model) : ANOVA F-tests on an essentially perfect fit are unreliable 4: In anova.lm(fullmodel) : ANOVA F-tests on an essentially perfect fit are unreliable 5: In anova.lm(full_model) : ANOVA F-tests on an essentially perfect fit are unreliable 6: In anova.lm(fullmodel) : ANOVA F-tests on an essentially perfect fit are unreliable
The code I am runing is: