可加模型的一个简单示例

news2024/11/28 18:49:31

Additive Models

to avoid the curse of dimensionality and for better interpretability we assume
m ( x ) = E ( Y ∣ X = x ) = c + ∑ j = 1 d g j ( x j ) m(\boldsymbol{x})=E(Y|\boldsymbol{X}=\boldsymbol{x})=c+\sum_{j=1}^dg_j(x_j) m(x)=E(YX=x)=c+j=1dgj(xj)
⟹ \Longrightarrow the additive functions g j g_j gj can be estimated with the optimal one-dimensional rate

two possible methods for estimating an additive model:

  • backfitting estimator
  • marginal integration estimator
    indentification conditions for both methods

E X j { g ( X j ) } = 0 , ∀ j = 1 , … , d ⟹ E ( Y ) = e \begin{aligned} E_{X_j}\{ g(X&_j) \}=0, \forall j=1,\dots,d\\ & \Longrightarrow E(Y)=e \end{aligned} EXj{g(Xj)}=0,j=1,,dE(Y)=e

formulation Hibert space framework:

  • let H Y X \mathcal{H}_{Y\boldsymbol{X}} HYX be the Hilbert space of random variables which are functions of Y , X Y, \boldsymbol{X} Y,X
  • let ⟨ U , V ⟩ = E ( U V ) \langle U,V\rangle=E(UV) U,V=E(UV) the scalar product
  • define H X \mathcal{H}_{\boldsymbol{X}} HX and H X , j = 1 , … , d \mathcal{H}_{X},j=1,\dots,d HX,j=1,,d the corresponding subspaces

⟹ \Longrightarrow we aim to find the element of H X 1 ⊕ ⋯ ⊕ H X d \mathcal{H}_{X_1}\oplus \cdots \oplus\mathcal{H}_{X_d} HX1HXd closest to Y ∈ H Y X Y\in\mathcal{H}_{Y\boldsymbol{X}} YHYX or m ∈ H X m\in \mathcal{H}_{\boldsymbol{X}} mHX
by the projection theorem, there exists a unique solution with
E [ { Y − m ( X ) } ∣ X α ] = 0    ⟺    g α ( X α ) = E [ { Y − ∑ j ≠ α g j ( X j ) } ∣ X α ] , α = 1 , … , d E[\{ Y-m(\boldsymbol{X}) \}|X_{\alpha}]=0\\ \iff g_{\alpha}(X_{\alpha})=E[\{ Y-\sum_{j\neq\alpha}g_j(X_j) \}|X_{\alpha}], \quad\alpha=1,\dots,d E[{Ym(X)}Xα]=0gα(Xα)=E[{Yj=αgj(Xj)}Xα],α=1,,d
denote projection P α ( ∙ ) = E ( ∙ ∣ X α ) P_{\alpha}(\bullet)=E(\bullet|X_{\alpha}) Pα()=E(Xα)
⟹ ( I P 1 ⋯ P 1 P 2 I ⋯ P 2 ⋮ ⋱ ⋮ P d ⋯ P d I ) ( g 1 ( X 1 ) g 2 ( X 2 ) ⋮ g d ( X d ) ) = ( P 1 Y P 2 Y ⋮ P d Y ) \Longrightarrow\left(\begin{array}{cccc} I & P_{1} & \cdots & P_{1} \\ P_{2} & I & \cdots & P_{2} \\ \vdots & & \ddots & \vdots \\ P_{d} & \cdots & P_{d} & I \end{array}\right)\left(\begin{array}{c} g_{1}\left(X_{1}\right) \\ g_{2}\left(X_{2}\right) \\ \vdots \\ g_{d}\left(X_{d}\right) \end{array}\right)=\left(\begin{array}{c} P_{1} Y \\ P_{2} Y \\ \vdots \\ P_{d} Y \end{array}\right) IP2PdP1IPdP1P2I g1(X1)g2(X2)gd(Xd) = P1YP2YPdY
denote by
S α the   ( n × n ) smoother matrix \bold{S}_{\alpha}\quad \text{the} \,(n\times n) \quad \text{smoother matrix} Sαthe(n×n)smoother matrix
such that S α Y \bold{S}_{\alpha}\boldsymbol{Y} SαY is an estimate of the vector { E ( Y 1 ∣ X α 1 ) , … , E ( Y n ∣ X α n ) } ⊤ \{ E(Y_1|X_{\alpha1}),\dots,E(Y_n|X_{\alpha n}) \}^{\top} {E(Y1Xα1),,E(YnXαn)}
⟹ ( I S 1 ⋯ S 1 S 2 I ⋯ S 2 ⋮ ⋱ ⋮ S d ⋯ S d I ) ⏟ n d × n d ( g 1 g 2 ⋮ g d ) = ( S 1 Y S 2 Y ⋮ S d Y ) \Longrightarrow \underbrace{\left(\begin{array}{cccc} \mathbf{I} & \mathbf{S}_{1} & \cdots & \mathbf{S}_{1} \\ \mathbf{S}_{2} & \mathbf{I} & \cdots & \mathbf{S}_{2} \\ \vdots & & \ddots & \vdots \\ \mathbf{S}_{d} & \cdots & \mathbf{S}_{d} & \mathbf{I} \end{array}\right)}_{n d \times n d}\left(\begin{array}{c} \boldsymbol{g}_{1} \\ \boldsymbol{g}_{2} \\ \vdots \\ \boldsymbol{g}_{d} \end{array}\right)=\left(\begin{array}{c} \mathbf{S}_{1} \boldsymbol{Y} \\ \mathbf{S}_{2} \boldsymbol{Y} \\ \vdots \\ \mathbf{S}_{d} \boldsymbol{Y} \end{array}\right) nd×nd IS2SdS1ISdS1S2I g1g2gd = S1YS2YSdY
note: infinite samples the matrix on the left side can be singular

Bacfitting algorithm

in practice, the following backfitting algorithm (a simplification of the Gauss-Seidel procedure) is used:


  • initialize g ^ ( 0 ) ≡ 0   ∀ α , c ^ = Y ˉ \hat{\boldsymbol{g}}^{(0)}\equiv 0 \,\forall\alpha,\hat{c}=\bar{Y} g^(0)0α,c^=Yˉ
  • repeat for α = 1 , … , d \alpha=1,\dots,d α=1,,d
    r α = Y − c ^ − ∑ j = 1 α − 1 g ^ j ( ℓ + 1 ) − ∑ j = α + 1 d g ^ j ( ℓ ) g ^ α ( ℓ + 1 ) ( ∙ ) = S α ( r α ) \begin{aligned} \boldsymbol{r}_\alpha & =\boldsymbol{Y}-\widehat{c}-\sum_{j=1}^{\alpha-1} \widehat{\boldsymbol{g}}_j^{(\ell+1)}-\sum_{j=\alpha+1}^d \widehat{\boldsymbol{g}}_j^{(\ell)} \\ \widehat{\boldsymbol{g}}_\alpha^{(\ell+1)}(\bullet) & =\mathbf{S}_\alpha\left(\boldsymbol{r}_\alpha\right) \end{aligned} rαg α(+1)()=Yc j=1α1g j(+1)j=α+1dg j()=Sα(rα)
  • proceed until convergence is reached

Example: smoother performance in additive models

simulated sample of n = 75 n = 75 n=75 regression observations with regressors X j X_j Xj i.i.d.
uniform on [ − 2.5 , 2.5 ] [-2.5, 2.5] [2.5,2.5], generated from
Y = ∑ j = 1 4 g j ( X j ) + ε , ε ∼ N ( 0 , 1 ) Y=\sum_{j=1}^4g_j(X_j)+\varepsilon, \quad \varepsilon\sim N(0,1) Y=j=14gj(Xj)+ε,εN(0,1)
where
g 1 ( X 1 ) = − sin ⁡ ( 2 X 1 ) g 2 ( X 2 ) = X 2 2 − E ( X 2 2 ) g 3 ( X 3 ) = X 3 g 4 ( X 4 ) = exp ⁡ ( − X 4 ) − E { exp ⁡ ( − X 4 ) } \begin{array}{ll} g_1\left(X_1\right)=-\sin \left(2 X_1\right) & g_2\left(X_2\right)=X_2^2-E\left(X_2^2\right) \\ g_3\left(X_3\right)=X_3 & g_4\left(X_4\right)=\exp \left(-X_4\right)-E\left\{\exp \left(-X_4\right)\right\} \end{array} g1(X1)=sin(2X1)g3(X3)=X3g2(X2)=X22E(X22)g4(X4)=exp(X4)E{exp(X4)}
Plotting results in this example:
Estimated (solid lines) versus true additive component functions (circles at the input values), local linear estimator with Quartic kernel, bandwidths h = 1:0

Code:

n = 75
X = matrix(NA, n, 4)
for (i in 1:4) {
  X[, i] = runif(n, min = -2.5, max = 2.5)
}

g1 = function(x) {
  return(-sin(2 * x))
}

g2 = function(x) {
  return(x ^ 2 - mean(x ^ 2))
}

g3 = function(x) {
  return(x)
}

g4 = function(x) {
  return(exp(-x) - mean(exp(-x)))
}
eps = rnorm(n)

###indicator function
I = function(x, index) {
  if (index == 1) {
    return(x)
  }
  if (index == 0) {
    return(0)
  }
}

x <- seq(-2.5, 2.5, l = 100)
Y = I(g1(X[, 1]), 1) + I(g2(X[, 2]), 0) + I(g3(X[, 3]), 0) + I(g4(X[, 4]), 0) + eps
fit_g1 <- loess(
  Y ~ x,
  family = 'symmetric',
  degree = 2,
  span = 0.7,
  data = data.frame(x = X[, 1], Y = Y),
  surface = "direct"
)
out_g1 <- predict(fit_g1,
                  newdata = data.frame(newx = x),
                  se = TRUE)
low_g1 <- out_g1$fit - qnorm(0.975) * out_g1$se.fit
high_g1 <- out_g1$fit + qnorm(0.975) * out_g1$se.fit
df.low_g1 <- data.frame(x = x, y = low_g1)
df.high_g1 <- data.frame(x = x, y = high_g1)
P1 = ggplot(data = data.frame(X1 = X[, 1], g1 = Y),
            aes(X1, g1)) +
  geom_point() +
  geom_smooth(method = "loess", show.legend = TRUE) +
  geom_line(data = df.low_g1, aes(x, y), color = "red") +
  geom_line(data = df.high_g1, aes(x, y), color = "red")

Y = I(g1(X[, 1]), 0) + I(g2(X[, 2]), 1) + I(g3(X[, 3]), 0) + I(g4(X[, 4]), 0) + eps
fit_g2 <- loess(
  Y ~ x,
  family = 'symmetric',
  degree = 2,
  span = 0.9,
  data = data.frame(
    x = X[, 2],
    Y = (Y - fit_g1$fitted),
    surface = "direct"
  )
)
out_g2 <- predict(fit_g2,
                  newdata = data.frame(newx = x),
                  se = TRUE)
low_g2 <- out_g2$fit - qnorm(0.975) * out_g2$se.fit
high_g2 <- out_g2$fit + qnorm(0.975) * out_g2$se.fit
df.low_g2 <- data.frame(x = x, y = low_g2)
df.high_g2 <- data.frame(x = x, y = high_g2)
P2 = ggplot(data = data.frame(X2 = X[, 2], g2 = (Y - fit_g1$fitted)),
            aes(X2, g2)) +
  geom_point() +
  geom_smooth(method = "loess", show.legend = TRUE) +
  geom_line(data = df.low_g2, aes(x, y), color = "red") +
  geom_line(data = df.high_g2, aes(x, y), color = "red")

Y = I(g1(X[, 1]), 0) + I(g2(X[, 2]), 0) + I(g3(X[, 3]), 1) + I(g4(X[, 4]), 0) + eps
fit_g3 <- loess(
  Y ~ x,
  family = 'symmetric',
  degree = 2,
  span = 0.9,
  data = data.frame(
    x = X[, 3],
    Y = (Y - fit_g1$fitted - fit_g2$fitted),
    surface = "direct"
  )
)
out_g3 <- predict(fit_g3,
                  newdata = data.frame(newx = x),
                  se = TRUE)
low_g3 <- out_g3$fit - qnorm(0.975) * out_g3$se.fit
high_g3 <- out_g3$fit + qnorm(0.975) * out_g3$se.fit
df.low_g3 <- data.frame(x = x, y = low_g3)
df.high_g3 <- data.frame(x = x, y = high_g3)
P3 = ggplot(data = data.frame(X3 = X[, 3], g3 = (Y - fit_g1$fitted - fit_g2$fitted)),
            aes(X3, g3)) +
  geom_point() +
  geom_smooth(method = "loess", show.legend = TRUE) +
  geom_line(data = df.low_g3, aes(x, y), color = "red") +
  geom_line(data = df.high_g3, aes(x, y), color = "red")

Y = I(g1(X[, 1]), 0) + I(g2(X[, 2]), 0) + I(g3(X[, 3]), 0) + I(g4(X[, 4]), 1) + eps
fit_g4 <- loess(
  Y ~ x,
  family = 'symmetric',
  degree = 2,
  span = 0.9,
  data = data.frame(
    x = X[, 4],
    Y = (Y - fit_g1$fitted - fit_g2$fitted - fit_g3$fitted),
    surface = "direct"
  )
)
out_g4 <- predict(fit_g4,
                  newdata = data.frame(newx = x),
                  se = TRUE)
low_g4 <- out_g4$fit - qnorm(0.975) * out_g4$se.fit
high_g4 <- out_g4$fit + qnorm(0.975) * out_g4$se.fit
df.low_g4 <- data.frame(x = x, y = low_g4)
df.high_g4 <- data.frame(x = x, y = high_g4)
P4 = ggplot(data = data.frame(
  X4 = X[, 4],
  g4 = (Y - fit_g1$fitted - fit_g2$fitted - fit_g3$fitted)
),
aes(X4, g4)) +
  geom_point() +
  geom_smooth(method = "loess", show.legend = TRUE) +
  geom_line(data = df.low_g4, aes(x, y), color = "red") +
  geom_line(data = df.high_g4, aes(x, y), color = "red")

cowplot::plot_grid(P1, P2, P3, P4, align = "vh")

result:

在这里插入图片描述

参考文献

https://academic.uprm.edu/wrolke/esma6836/smooth.html

Hastie, T. J. and Tibshirani, R. J. (1990). Generalized Additive Models, Vol. 43 of Monographs on Statistics and Applied Probability, Chapman and Hall, London.

Opsomer, J. and Ruppert, D. (1997). Fitting a bivariate additive model by local polynomial regression, Annals of Statistics 25: 186-211.

Mammen, E., Linton, O. and Nielsen, J. P. (1999). The existence and asymptotic properties of a backfitting projection algorithm under weak conditions, Annals of Statistics 27: 1443-1490.

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/597711.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

高压放大器和示波器的关系是什么

高压放大器和示波器是电子工程领域中常见的两种设备&#xff0c;它们在实际的电路设计、测试和分析中都扮演着重要的角色。下面安泰电子将从定义、功能、应用场景等方面为您介绍高压放大器和示波器的关系。 图&#xff1a;ATA-7000系列高压放大器 一、高压放大器的定义及功能 高…

【软件测试】软件测试理论总结笔记(一)

软件测试理论总结 1.Introduction1.1 What is Software Bug1.3 Tester的职责和目标其他概念 2.软件开发生命周期Software Development ProcessSoftware Development Lifecycle Models2.1 TDD - Test-Driven Development测试驱动开发&#xff08;一种敏捷开发&#xff09;Softwa…

Chrome浏览器无痕浏览真的无痕吗?

当您启用无痕浏览后&#xff0c;设备的其他用户将不会看到您的历史记录。 Chrome 不会保存您的浏览记录或您在表单中填写的信息。当您浏览时&#xff0c;Chrome 会记住相应的 Cookie 和网站数据&#xff0c;但当您退出无痕模式时&#xff0c;Chrome 会删除这些数据。您可在打开…

【Android】Binder(一)Binder的介绍和AIDL使用Binder的实例

Binder介绍 Android 中的 Binder 是一个进程间通信机制&#xff0c;它允许不同进程之间相互调用方法和传递数据。Binder 主要用于实现系统服务和应用程序之间的通信&#xff0c;以及实现 IPC&#xff08;Inter-Process Communication&#xff0c;进程间通信&#xff09;。 Bi…

陪诊APP小程序开发 陪伴就医告别孤独

生活工作忙碌&#xff0c;很多情况下父母或者其他亲人需要去医院的时候没办法陪同&#xff0c;让其单独去又不放心成为令很多人苦恼的问题。随着移动互联网的深入到我们生活的方方面面&#xff0c;医疗行业也出现了很多陪诊服务APP小程序系统软件&#xff0c;让孤独就医者有人陪…

Android H5拉起安卓原生方案的介绍与实战(六一篇)

一、介绍 今天是6.1儿童节&#xff0c;祝大家儿童节快乐。 言归正传&#xff0c;开始介绍H5拉起原生。如今&#xff0c;在APP应用中&#xff0c;消息大多数采用推送方式比较多&#xff0c;到达率很低或者说无法满足业务的需求。在一些大型活动中&#xff0c;依然需要短信的参与…

网络安全:SQL 注入漏洞

一、漏洞描述 WordPress是一个用PHP编写的免费开源内容管理系统&#xff0c;由于clean_query函数的校验不当&#xff0c;导致了可能通过插件或主题以某种方式从而触发SQL注入的情况。这已经在WordPress5.8.3中进行了修复。影响版本可以追溯到3.7.37。 二、漏洞分析 在分析整…

平台使用篇 | 批处理(bat)脚本使用教程(四)

导读 一个开启多机软件在环仿真的批处理文件 (对应卓面RflyTools文件夹中SITLRun快捷方式)&#xff0c;双击它&#xff0c;输入想要生成的飞机数量&#xff0c;即可生成多机软件在环仿真&#xff0c;等待RflySim3D显示3DFixed 4/4&#xff0c;然后可通过QGC控制飞机起飞。运行…

Unity API详解——Time类

Time类是Unity中获取时间信息的接口类&#xff0c;只有静态属性。本博客介绍Time类的一些静态属性。 一、Time类静态属性 在Time类中&#xff0c;涉及的静态属性有realtimeSinceStartup、smoothDeltaTime和time属性&#xff0c;在介绍time属性时涉及了Time类的多个其他属性的…

学姐生日快到了~这不得用Python把她的照片做成视频当礼物送给她....

前言 这不是学姐生日快到了&#xff0c;于是我学了一手Python~ 来把学姐的照片生成为视频&#xff0c;到时候给她一个惊喜&#xff01; 好了先不说了&#xff0c;下面分享一下用python代码 实现多张图片合成MP4视频为实例&#xff0c;做下详细代码讲解。 一、需要调入的模块…

设计模式之~迭代器模式

迭代器模式&#xff1a; 迭代器&#xff08;Iterator&#xff09;模式&#xff0c;又叫做游标&#xff08;Cursor&#xff09;模式。GOF 给出的定义为&#xff1a;提供一种方法顺序访问一个容器&#xff08;container&#xff09;对象中各个元素&#xff0c;而又不需暴露该对象…

数据库DBMS并发控制(1)

pgsql&#xff08;PostgreSQL&#xff09;常用命令行操作_pgsql常用命令_石头wang的博客-CSDN博客 重要&#xff1a;事务的操作和事务的性质 操作演示 四种典型数据不一致现象: 串行调度和可串行调度 串行调度 顾名思义 就是可以进行调度的意思 可串行调度 就是 一种和串行…

C Primer Plus第十六章编程练习答案

学完C语言之后&#xff0c;我就去阅读《C Primer Plus》这本经典的C语言书籍&#xff0c;对每一章的编程练习题都做了相关的解答&#xff0c;仅仅代表着我个人的解答思路&#xff0c;如有错误&#xff0c;请各位大佬帮忙点出&#xff01; 由于使用的是命令行参数常用于linux系…

常见的ACL攻击方式,集权设施如何防御攻击?

本文主要介绍了 WindowsAD域中基于访问控制列表&#xff08;ACL&#xff09;的攻击&#xff0c;在AD域的攻击手法中&#xff0c;基于ACL的攻击由于理解起来比较困难&#xff0c;现有的安全设备也很少有对ACL的监控&#xff0c;这种类型的攻击通常会被安全人员所忽视。 1.什么是…

[SpringBoot]创建聚合项目

首先&#xff0c;创建父级项目&#xff1a; 因为手动添加依赖&#xff0c;以下只选版本不打钩 因为父项目不写代码&#xff0c;所以删除src 调整pom.xml文件&#xff08;并刷新maven&#xff09;&#xff0c;如下&#xff1a; <?xml version"1.0" encoding&qu…

如何入门渗透测试

1. 什么是渗透测试 渗透测试就是模拟真实黑客的攻击手法对目标网站或主机进行全面的安全评估&#xff0c;与黑客攻击不一样的是&#xff0c;渗透测试的目的是尽可能多地发现安全漏洞&#xff0c;而真实黑客攻击只要发现一处入侵点即可以进入目标系统。 一名优秀的渗透测试工程…

Flink SQL之Regular Joins

1.Regular Joins&#xff08;双流join&#xff09; 双流join是最通用的联接类型&#xff08;支持 Batch\Streaming&#xff09;&#xff0c;其中任何新记录或联接两侧的更改都是可见的&#xff0c;并影响整体的Join结果。 特点&#xff1a; 对于流式查询&#xff0c;双流join…

深入分析 OpenShift 内部 DNS

深入分析 OpenShift 内部 DNS OpenShift 中的DNS 相关组件及其配置1.1 Pod 中的 DNS 配置1.2 Pod 所在宿主机上的 DNS 配置及服务1.2.1 resolv.conf 文件 DNS 配置DNS 查询流程为什么需要内部 DNS&#xff1f; 本文基于 OpenShift 3.11&#xff0c;Kubernetes 1.11 进行测试 O…

Linux服务器禁止密码登录,设置秘钥登录

生成SSH密钥 (客户机端) 执行ssh-keygen -t rsa命令创建RSA密钥对&#xff0c;执行结果如下(键入3次回车)&#xff1a; [rootnode01 .ssh]# ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): [回车] En…

【十五】设计模式~~~行为型模式~~~状态模式(Java)

【学习难度&#xff1a;★★★☆☆&#xff0c;使用频率&#xff1a;★★★☆☆】 4.1. 模式动机 在很多情况下&#xff0c;一个对象的行为取决于一个或多个动态变化的属性&#xff0c;这样的属性叫做状态&#xff0c;这样的对象叫做有状态的(stateful)对象&#xff0c;这样的…