简体   繁体   English

问:mgcv::gam() 对系数有限制

[英]Q: mgcv::gam() with constraints on the coefficents

I'm fitting a logit GAM model and need to impose an inequality constraints on beta's in the smooth terms.我正在拟合 logit GAM model 并且需要在平滑条件下对 beta 施加不等式约束。 I've tried mgcv::pcls() but it seems I can't specify the independent inequalities for the different spline coefficients.我试过 mgcv::pcls() 但似乎我无法为不同的样条系数指定独立的不等式。 What's the recommended way to achieve this?实现这一目标的推荐方法是什么?

Found an answer myself, posting it just in case someone will look for it.自己找到了答案,发布它以防有人会寻找它。 Mono.con function in mgcv generates constraint matrices Ain and bin. mgcv 中的 Mono.con function 生成约束矩阵 Ain 和 bin。 For several splines, Ain matrices should be just put together into a single block-diagonal matrix.对于几个样条,Ain 矩阵应该只是放在一起成一个块对角矩阵。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM