Description Usage Arguments Value See Also Examples
This function extracts coefficients from a amias or samias object.
1 2 3 4 |
object |
A list with class attribute 'amias' or 'samias'. |
type |
A character string, one of |
k |
An integer vector of numbers of knots at which coefficients should be calculated. The user can choose to a subset of index from 1,2,…, kmax; none are specified, then it returns the optimal coefficient determined by miniming the BIC value. |
... |
additional arguments passed to coef. |
Returns a list with the following components:
alpha |
If the type is |
v |
If the type is |
u |
If the type is |
A |
If the type is |
k |
An integer that specifies the optimal |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ##----- A toy example -------
set.seed(0)
n <- 100
x = seq(1/n, 1,length.out = n)
y0 = 0*x; y0[x>0.5] = 1
y = y0 + rnorm(n, sd = 0.1)
# For 'amias' object
fit <- amias(y, k = 1)
coef(fit) # extract the fitting coefficients
coef(fit, type="active") # extract the detected knots
# For 'samias' object
fit <- samias(y, kmax = 6)
coef(fit) # get the coefficients with the minimum BIC value
coef(fit, k = 3:5) # get the coefficients that number of knots being 3, 4, and 5
coef(fit, type="active") # get the active set with minimum BIC value
coef(fit, type="active", k = 3:5) # get the active sets that number of knots being 3, 4, and 5
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.