Comments (6)
LOESS
Figure 6.9 has been reproduced in https://esl.hohoweiya.xyz/rmds/lattice.html. It shows that
- given
wind
andtemp
,ozone
tends to increase alongradiation
, which can be observed from almost every panels, except that the ozone can decrease a little when radiation is highest, such as panel (4, 3). - given
wind
, i.e., for each row, the increasing magnitude and baseline ofozone
alongradiation
would be increasing for the increasingtemp
. Or in other words, further givenradiation
, say the two extreme points,ozone
tends to increase alongtemp
. - given
temp
, i.e., for each column, the baseline (or say the minimum and maximum) ofozone
alongradiation
decreases alongwind
from esl-cn.
GAM
# GAM
library(gam)
fit = gam(I(ozone^(1/3))~s(temperature) + s(wind) + s(radiation), data = data)
par(mfrow=c(1, 3))
plot(fit, se = T)
It is clear that the contribution of each feature captures the same pattern as concluded for Fig. 6.9.
- the contribution of
temp
increases alongtemp
- the contribution of
wind
decreases alongwind
- the contribution of
radiation
increases alongradiation
from esl-cn.
Tree
library(rpart)
library(rpart.plot)
fit.tree = rpart(I(ozone^(1/3))~ temperature + wind + radiation, data = data)
rpart.plot(fit.tree)
Note that the response value in the leaf node increases from left to right, then we can observe that
- small
radiation
goes to the left, i.e.,ozone
tends to increase alongradiation
. - small
temp
goes to the left, i.e.,ozone
tends to increase alongtemp
. - small
wind
goes to the right, i.e.ozone
tends to decrease alongwind
.
from esl-cn.
MARS
> # MARS
> library(earth)
> fit.mars = earth(I(ozone^(1/3))~ temperature + wind + radiation, data = data)
> summary(fit.mars)
Call: earth(formula=I(ozone^(1/3))~temperature+wind+radiation, data=data)
coefficients
(Intercept) 2.72035983
h(temperature-73) 0.07721326
h(temperature-90) -0.11780995
h(9.7-wind) 0.17106469
h(225-radiation) -0.00317888
Selected 5 of 14 terms, and 3 of 3 predictors
Termination condition: Reached nk 21
Importance: temperature, wind, radiation
Number of terms at each degree of interaction: 1 4 (additive model)
GCV 0.2185924 RSS 20.48861 GRSq 0.7267643 RSq 0.7650625
Note the basis function and the sign of coefficients,
- for
temp
, positive coef in [73, 90], and then negative coef in [90, ~], which indicates thatozone
tends to increase alongtemp
, but a little decrease for highertemp
. The tail decreasing pattern has also been shown in the lower confidence curve in GAM - for
wind
, positive coef in [9.7, ~], which indicates thatozone
tends to decrease alongwind
- for
radition
, negative coef in [225, ~], which indicates thatozone
tends to increase alongradiation
Interestingly, the reflection pairs do not return as in https://github.com/szcf-weiya/ESL-CN/blob/3aefb0bc171e272ca87af159e1d665d1d56b4c9f/code/MARS/simulation.R
from esl-cn.
PRIM
library(prim)
fit.prim = prim.box(as.matrix(data[,-1]), as.numeric(data[, 1]))
summary(fit.prim, print.box = T)
plotprim = function(x, y, box = box, ...) {
plot(x, y, ...)
rect(box[1, 1], box[1, 2], box[2, 1], box[2, 2], border = "red")
}
colname = colnames(data)
par(mfrow = c(1, 3))
for (i in 2:3)
for (j in (i+1):4)
plotprim(data[,i], data[, j], fit.prim$box[[1]][,c(i-1, j-1)],
xlab = colname[i], ylab = colname[j])
It seems that plot.prim
does not plot the box, and also cannot superimpose on the original observation points, so I wrote the plot function by myself.
Note that the box indicates large ozone
, so it reveals that
- from the first two panels, large
radiation
tends to have largeozone
, i.e., increase - from the last two panels, small
wind
tends to have largeozone
, i.e., decrease - from panel 1 and 3, large
temp
tends to have largeozone
, i.e., increase
from esl-cn.
Conclusion: all these methods obtain similar results in terms of the trend of every single variable.
from esl-cn.
Related Issues (20)
- Ex. 18.16 HOT 1
- Phoneme Data
- Ex. 6.8 HOT 1
- Ex. derive natural spline bases from B-spline bases HOT 2
- Ex. 9.5 HOT 7
- unclickable nav in the header
- broken gravatar for mainland China HOT 1
- disappeared avatar on the n-th (n>=2) level in phones from mainland China
- workflow for Rmd notes
- ok
- Fig. 18.1 HOT 5
- Ex 8.1 HOT 1
- Ex. 2.2
- Chapter 1.1 - Website URL of ESL is unavailable HOT 1
- Fig. 8.6 and Tab. 8.2: Example for EM HOT 2
- 请问一下,链接是不是失效了呀?那个网址esl.hohoweiya.xyz进不去了 HOT 2
- Ex. 3.7 HOT 1
- Fig. 14.29 HOT 1
- Fig. 14.30 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from esl-cn.