TermBuilder.vc()#
- TermBuilder.vc(x, by, prefix='', name=None)[source]#
Varying coefficient term.
- Parameters:
by (
StrctTerm) – Smooth term, aStrctTermthat represents the smoothly varying coefficient of this term, for example a P-splineps().prefix (
str, default:'') – A string prefix to be added to the returned term’s name.name (
str|None, default:None) – Manually defined name of the term. If a prefix is specified, the prefix will be added to this name.
- Return type:
Notes
A varying coefficient term can be written as
\[x \beta(z),\]where \(x\) is a covariate, and \(\beta(z)\) is the linear effect of this covariate, which smoothly varies as a function of another variable \(z\).
Examples
>>> import liesel_gam as gam >>> df = gam.demo_data(100) >>> tb = gam.TermBuilder.from_df(df) >>> psx = tb.ps("x_nonlin", k=20) >>> tb.vc(x="x_lin", by=psx) Var(name="x_lin*ps(x_nonlin)")