[R] Help using R Sensitivity

jody.kelly jody.kelly at northumbria.ac.uk
Mon Apr 18 09:45:26 CEST 2016


I am currently using the sensitivity package standard regression coefficient in order to rank variable importance in a model. I am new to using R so there may be some obvious things I am unaware of, apologies in advance as I am still learning.

I am using the following which I have taken straight from the help guide.

# a 100-sample with X1 ~ U(0.5, 1.5)
# X2 ~ U(1.5, 4.5)
# X3 ~ U(4.5, 13.5)

n <- 100
X <- data.frame(X1 = runif(n, 0.5, 1.5),
X2 = runif(n, 1.5, 4.5),
X3 = runif(n, 4.5, 13.5))

# linear model : Y = X1 + X2 + X3

y <- with(X, X1 + X2 + X3)

# sensitivity analysis

x <- src(X, y, nboot = 100)


This gives me ranks of the variables I have defined between -1 - 1. However this is the part I am unsure of how to apply to my own model.
I hope some one can give me advice on how to do this based on my own model as follows:

Model type: building energy consumption model.
Model Input variables (X): parameters relating to the building (X1 = 1.5-3.5, X2 = 7-12, X3 = 0.5 - 3, X4 = 10-15)
Model output variables (Y): Monthly Gas and electricity energy consumption

The spread sheet is as follows:  No of simulations: 1-40, for each simulation a new combination of model inputs (X) is used, therefore each simulation output (Y) will be different.

The aim of this analysis based on the 40 simulations is to rank input variables (X1-X4) based on importance of 1-4 with one being the most influential parameter and 4 being the least. What these variables are ranked upon, is their effect on the output variable (Y) which is energy consumption. Two variables will primarily have an effect on gas energy usage, and two will have an effect primarily on electricity energy usage. The aim is to produce a graph with left Y axis showing rank importance 1-4, X axis showing months January to December and the Y axis right showing the input variables with plots at each month showing its rank.

The spread sheet titles are set up as below. There are 40 simulations with varying combinations of X1-X4. Below each X value (X1-4) will be the input parameter value. Each simulations Y value will also change due to the change in variable combinations.

              Variable combinations (X)Y
Simulation No.X1X2X3X4JanFebMarAprMayJunJulAugSepOctNovDec

Thanks for any help in advance, much appreciated.


This message is intended solely for the addressee and may contain confidential and/or legally privileged information. Any use, disclosure or reproduction without the sender’s explicit consent is unauthorised and may be unlawful. If you have received this message in error, please notify Northumbria University immediately and permanently delete it. Any views or opinions expressed in this message are solely those of the author and do not necessarily represent those of the University. The University cannot guarantee that this message or any attachment is virus free or has not been intercepted and/or amended.

More information about the R-help mailing list