2
$\begingroup$

Disclaimer: not a statistics student, I am a civil engineering undergrad currently writing my thesis. And, I have never done a multiple regression analysis before.

Half of my study is cost estimation of a retrofitting project. I have a data set to use, albeit with just about 35 data points. My main adviser told me to use a simple linear regression using the total floor building area only to predict the cost. All good, and very simple especially since you only need to plug in the building area, and ta-da you get the cost.

However, I feel like this is very one-dimensional. All the cost estimation models I read online relating to my study are using multiple variables. I came to realize this when I was presenting my regression model, one panelist pointed out that some data points are clustered together, which might indicate that there is some hidden variable that could be affecting the regression model. I have not asked my adviser about this yet.

The data set given to me has other variables to consider:

  • total building floor area (which I used)
  • number of floors
  • year of construction
  • proximity to fault line
  • liquefaction potential (qualitative: safe, low, high, moderate)

Do I need to use multiple regression here? Does my data set have enough points for it?

$\endgroup$

3 Answers 3

1
$\begingroup$

I would agree with your supervisor. That's good enough for the data you have and your knowledge.

However, its easy enough to run a multiple linear regression (even in excel if you enable/download the analysis toolpak)

then you would check for the significance of each coefficient (but would have to do some multiple testing adjustment eg Bonferroni (divide the test criterion value eg p=0.05 by the number of coefficient tests, 5)

you could review whether the sign of the coefficients made sense.

one of the issues you are facing is that the data is observational rather than from an experiment, so there are likely to be lots of hidden correlations which might make the meaning of the coefficients suspect. eg perhaps more recent buildings are larger, being closer to a fault line is actually associated with an omitted variable like property prices.

$\endgroup$
1
$\begingroup$

One small tip here: Two of your variables (total floor area and number of floors) have a direct causal relationship that will make them strongly correlated. In order to reduce this collinearity I recommend you change the first variable to look at average area per floor instead of total area. This change in the input variables will allow you to decompose the effects of the number of floors and the area-per-floor more easily and will make the output of your model easier to interpret. You can also add an interaction term between these variables and if you do it will decompose the relationships more sensibly.

$\endgroup$
-1
$\begingroup$

This is a multiple regression problem, addressable with either linear regression or a generalized linear model.

I would start out with multiple linear regression, possibly including interactions between variables and do a bit of variable selection to find out which predictors are the most relevant. The best thing would be to split the dataset in a training and validation set, but your sample seems to be very small for this to be useful.

In R, linear regressions can be fitted with the lm command. For variable selection, using the subset regression approach, you find an implementation in the olsrr package.

R Appendix (with commentary)

Install and load the olsrr package.

install.packages("olsrr")
library(olsrr)

Load the data in R

mydata <- read.table("cost_estimation.txt", 
                     header= TRUE,
                     dec= ",")

I have shortened the names of the variables with respect to your original file:

  • "Total Project Cost (in local currency)" -> cos
  • "Total Building Floor Area (sq. m.)" -> area
  • "Number of Floors" -> floors
  • "Year of Construction" -> year
  • "Proximity to the Fault Line (km)" -> fault_line
  • "Liquefaction Potential (qualitative rating)" -> liquefaction
  • "FEMA-154 Rating" -> FEMA_154
  • "SVR Version 1.1" -> SVR_v1.1

Then I do some housekeeping. In particular, I model the natural logarithm of cost but feel free to switch to the original scale if you are not convinced. It seems more natural to me to model cost in log scale since this typically causes the response to be less skewed, thus leading typically to more symmetric residuals. Furthermore, I scaled year variable to "time in years" computed as year - minimum of year.

mydata$log_cost <- log(mydata$cost) # natural log of cost
# remove the original cost var from the dataset
mydata$cost <- NULL 

# time in years (see description above)
mydata$time_y <- mydata$year - min(mydata$year)

# year is not needed anymore
mydata$year <- NULL

# convert liquefaction in a factor
mydata$liquefaction <- as.factor(mydata$liquefaction)

Now the multiple regression. Without doing model selection, (as suggested by @seanv507) we can fit the multiple regression model by

mod <- lm(log_cost ~ ., data = mydata)

and then check the output (below the command I report also the output)

> summary(model)

Call:
lm(formula = log_cost ~ ., data = mydata)

Residuals:
     Min       1Q   Median       3Q      Max 
-1.19417 -0.33599  0.04854  0.41863  1.04916 

Coefficients:
                       Estimate Std. Error t value Pr(>|t|)    
(Intercept)          17.1773984  2.6713375   6.430 5.80e-07 ***
area                  0.0003540  0.0001071   3.304  0.00261 ** 
floors                0.4967551  0.1057649   4.697 6.35e-05 ***
fault_line           -0.0227759  0.0753314  -0.302  0.76463    
liquefactionLow       1.4190090  0.5696939   2.491  0.01895 *  
liquefactionModerate  0.3078771  0.4631636   0.665  0.51166    
liquefactionSafe      0.7917331  0.4377499   1.809  0.08126 .  
FEMA_154             -0.5305908  0.4149623  -1.279  0.21152    
SVR_v1.1             -0.0392504  0.0298238  -1.316  0.19882    
time_y               -0.0137031  0.0133730  -1.025  0.31428    
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.5564 on 28 degrees of freedom
Multiple R-squared:  0.7507,    Adjusted R-squared:  0.6706 
F-statistic:  9.37 on 9 and 28 DF,  p-value: 2.095e-06

As you can see, the model does a pretty good job at describing the response (e.g. adjusted $R^2=67\%$), though some of the variables seem to be not relevant.

Applying a variable selection procedure, here I'm using subset selection we get

> ols_step_best_subset(model)
                          Best Subsets Regression                          
---------------------------------------------------------------------------
Model Index    Predictors
---------------------------------------------------------------------------
     1         area                                                         
     2         floors liquefaction                                          
     3         area floors liquefaction                                     
     4         area floors fault_line liquefaction                          
     5         area floors liquefaction FEMA_154 SVR_v1.1                   
     6         area floors liquefaction FEMA_154 SVR_v1.1 time_y            
     7         area floors fault_line liquefaction FEMA_154 SVR_v1.1 time_y 
---------------------------------------------------------------------------

                                                   Subsets Regression Summary                                                   
--------------------------------------------------------------------------------------------------------------------------------
                       Adj.        Pred                                                                                          
Model    R-Square    R-Square    R-Square     C(p)        AIC        SBIC        SBC        MSEP       FPE       HSP       APC  
--------------------------------------------------------------------------------------------------------------------------------
  1        0.3070      0.2878      0.1304    43.8405    96.5277    -13.8828    101.4405    25.4360    0.7045    0.0191    0.7700 
  2        0.6401      0.5964       0.563     8.4333    77.6374    -34.5702     87.4630    13.6010    0.4092    0.0112    0.4217 
  3        0.7296      0.6873      0.6237     0.3758    68.7692    -41.1882     80.2323    10.5275    0.3248    0.0089    0.3340 
  4        0.7334      0.6818      0.5636     1.9513    70.2343    -39.0622     83.3350    10.7047    0.3384    0.0093    0.3474 
  5        0.7414      0.6810      0.5359     3.0509    71.0744    -37.2581     85.8127    10.7179    0.3471    0.0097    0.3556 
  6        0.7499      0.6809      0.5183     4.0914    71.7982    -35.3518     88.1741    10.7093    0.3551    0.0100    0.3630 
  7        0.7507      0.6706      0.4361     6.0000    73.6743    -32.7058     91.6878    11.0426    0.3747    0.0107    0.3822 
--------------------------------------------------------------------------------------------------------------------------------
AIC: Akaike Information Criteria 
 SBIC: Sawa's Bayesian Information Criteria 
 SBC: Schwarz Bayesian Criteria 
 MSEP: Estimated error of prediction, assuming multivariate normality 
 FPE: Final Prediction Error 
 HSP: Hocking's Sp 
 APC: Amemiya Prediction Criteria 

From these results we can conclude that the "best" model, that is, the model with the best in-sample predictive performance is model 3, which includes covariates area floors and liquefaction.

$\endgroup$
12
  • $\begingroup$ Happy to answer if you need more details. $\endgroup$
    – utobi
    Commented Oct 9, 2022 at 8:20
  • $\begingroup$ Thanks for the insight. I have never used R before, surely I can use Excel here, no? But if R is really the right tool for the job, I'm ready to learn from scratch. I'm just not sure how long it will take me until I can implement a multiple linear regression. I have a background in programming though. $\endgroup$ Commented Oct 9, 2022 at 8:29
  • 1
    $\begingroup$ doing stat with Excel is a hopeless task :-). Learning R can be time-consuming, but it will be rewarding in the long run. You can also use python, though I'm not familiar with it. $\endgroup$
    – utobi
    Commented Oct 9, 2022 at 8:32
  • 1
    $\begingroup$ @utobi here is the data $\endgroup$ Commented Oct 9, 2022 at 9:18
  • 1
    $\begingroup$ @utobi I appreciate the detailed follow-up. I'm going to show this to my adviser and discuss with him my options. $\endgroup$ Commented Oct 10, 2022 at 2:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.