Open nikosGeography opened 6 months ago
Hi @nikosGeography, thanks for using StepReg. It appears that the dataset in your Google Drive is missing, so I'm unable to provide specific suggestions. From the description in the SF object, I'm not entirely sure what type of stepwise regression you intend to perform. My understanding is that stepwise regression is typically used to find the best combination of predictors. However, it seems like your dataset has only 2 columns (1 dependent and 1 independent variable), and you plan to remove some observations to monitor the R-square value. Could you please clarify?
Junhui
I apologize for the broken link I provided. You can now download the dataset, I updated the link in the question. As for the clarification, you described my problem than me. I have one dependent variable, called ntl, and I plan to remove rows from the sf object (called road) which are road classes.
Thank you for creating the package, it's easy to use and the examples are very useful. I want to perform stepwise linear regression using backward elimination to find the optimal model based on the r-squared. So far, I managed to do that using "brute-force" (please see the code below).
I have a sf object with two columns. The column I am interested in is called fclass. This columns has unique values which I want to use them as predictors. This means that, my baseline model will have all the classes (i.e., the sf object itself). The stepwise model will eliminate the unique values from the fclass column and eventually will print the remaining unique values which yielded the largest r-squared.
My code so far:
but it's not efficient (it takes ~ 5 minutes).
The unique values in the fclass column:
I was wondering if you could help use the
stepwise
function to perform the regression I described above. You can download the data from GoogleDrive.Best wishes.