Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

  • dd9e837
  • /
  • man
  • /
  • tp.Rd
Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
content badge
swh:1:cnt:234486096efe83e6d6fb066c42a11880af18deef
directory badge
swh:1:dir:dfc2869329ac84b1e2f233c8698b212954334ad0

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
tp.Rd
\name{tp}
\alias{tp}
\alias{bsp}
\title{Generate basis functions for penalized spline smoothing.}
\usage{
tp(x, degree=1, k=15, by=NULL, allPen=FALSE, varying=NULL, diag=FALSE,
    knots=quantile(x, probs = (1:(k - degree))/(k - degree  + 1)), 
    centerscale=NULL, scaledknots=FALSE)
    
bsp(x, k=15, spline.degree=3, diff.ord=2, knots, by,
    allPen=FALSE, varying, diag=FALSE)
    }
\note{These are from the \code{amer} package that has retired from CRAN.}
\description{\code{tp} generates a truncated power basis and \code{bsp} generates a reparameterized b-spline basis for penalized spline smoothing.}

\details{

\code{tp} generates truncated power bases which have \code{degree} unpenalized basis functions, namely \eqn{x^1,\dots, x^{degree}} and \eqn{k-}\code{degree} penalized basis functions that contain the positive part \eqn{(x-\kappa_j)^{degree}} for knots \eqn{\kappa_j, j=1,dots,k-}\code{degree}.
This function can be used as a reference when implementing other \code{basisGenerators} that can be used for additive models through \code{cpglmm}. 

\code{bsp} generate a b-spline basis with equidistant knots in mixed model reparameterization.}

\value{list with entries:
\code{"X"}: For \code{tp}, it is an \code{n x degree} design matrix for unpenalized part (without intercept) (or a list of those for every level of by if allPen=F); and for \code{bsp}, it is an \code{n x (diff.ord - 1)} design matrix for unpenalized part (without intercept).

\code{"Z"}: For \code{tp}, it is an \code{n x (k-degree)} design matrix for penalized part (or a list of those for every level of by if allPen=F); and for \code{bsp}, it is an \code{n x (k - diff.ord+1)} design matrix for penalized part.}


\arguments{\item{x}{covariate for the smooth function}
\item{degree}{integer: degree of truncated polynomials (0: piecewise constant, 1: piecewise linear etc..)}
\item{k}{integer: dimensionality of the basis (i.e.: number of knots + degree)}
\item{by}{factor variable: estimate separate functions for each level - this assumes standard treatment contrasts for the supplied factor.}
\item{allPen}{boolean: if TRUE, make design for group-specific curves with common smoothing parameter: all parameters (including the normally unpenalized basis functions in X) are penalized, every level of "by" has the same amount of smoothing 
if FALSE, make design for separate curves for each by-level: separate smoothing parameters for every level of "by", unpenalized estimates for the coefficients associated with X}
\item{varying}{numeric: if not NULL, a varying coefficient model is fit: f(x,varying) = f(x)*varying}
\item{diag}{logical: force a diagonal covariance-matrix for the random effects for X if \code{allPen=TRUE}?}
\item{knots}{vector of knot locations (optional). Defaults to quantile-based knots at the \eqn{i/(k+1-}degree)-quantiles 
		  for \eqn{i=1,\dots,k-}degree.}
\item{centerscale}{numeric(2): center&scale x by these values if not NULL}
\item{scaledknots}{boolean:	are knot locations given for the rescaled x-values?}
\item{spline.degree}{integer: degree of B-splines (defaults to cubic)}
\item{diff.ord}{integer: order of the difference penalty on the un-reparamerized spline coefficients. Defaults to 2, that is, penalized deviations from linearity.}

}

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API