Reg.ispline {zetadiv} | R Documentation |
Perform an I-spline regression
Description
Evaluates the I-splines for all variables of a data frame of predictor variables, and perform a generalised linear regression with constraint on the parameters.
Usage
Reg.ispline(
response,
predictor,
order.ispline = 2,
kn.ispline = 1,
family = stats::gaussian(),
method.glm = "glm.fit.cons",
cons = 1,
cons.inter = 1,
control = list(),
Plot = TRUE,
lty = NULL,
lwd = 1
)
Arguments
response |
A vector of numeric values representing the response variable. |
predictor |
A data frame of numeric variables representing the predictors. |
order.ispline |
Order of the I-spline. |
kn.ispline |
Number of knots in the I-spline. |
family |
A description of the error distribution and link function to be used in the |
method.glm |
Method used in fitting the generalised linear model. The default method |
cons |
type of constraint in the glm if |
cons.inter |
type of constraint for the intercept. Default is 1 for positive intercept, suitable for Gaussian family. The other option is -1 for negative intercept, suitable for binomial family. |
control |
As for |
Plot |
Boolean value indicating if the I-splines must be plotted. |
lty |
Line types to be used in the plotting. If nothing is provided, |
lwd |
Line width. |
Details
Reg.ispline
performs a non-linear regression using a combination of GLM and I-splines. It can, for example, be used to compare regression outputs when using MS-GDM with I-splines on environmental variables and biotic variables as in Zetya.msgdm
to the same regression approach without environmental variables.
Value
Reg.ispline
returns a list of the following elements:
splines |
A data frame in which each columns contains the value resulting from the transformation of the predictors into individual I-splines. The number of columns of |
spline |
A data frame in which each columns contains the value resulting from the combinations of the individual I-splines. This combination is obtained by multiplying the coefficients of |
.
model |
A |
.
References
Ramsay, J. O. (1988). Monotone regression splines in action. Statistical Science, 425-441.
See Also
Examples
utils::data(Marion.species)
xy.marion <- Marion.species[1:2]
data.spec.marion <- Marion.species[3:33]
##random other communities
data.spec.marion2a <- data.spec.marion
data.spec.marion2a[which(data.spec.marion2a==1,arr.ind=TRUE)] <- 0
for(i in 1:ncol(data.spec.marion2a))
data.spec.marion2a[sample(nrow(data.spec.marion2a),8),i] <- 1
data.spec.marion2b <- data.spec.marion
data.spec.marion2b[which(data.spec.marion2b==1,arr.ind=TRUE)] <- 0
for(i in 1:ncol(data.spec.marion2b))
data.spec.marion2b[sample(nrow(data.spec.marion2b),8),i] <- 1
dat.spec.tot <- list(data.spec.marion,data.spec.marion2a,data.spec.marion2b)
zeta.tot <- Zeta.order.mc.mult(data.spec=dat.spec.tot,order=3,sam=200)
zeta.splines <- Ispline(zeta.tot$zeta.val[,2:3])
data.tot <- data.frame(zeta.val=zeta.tot$zeta.val[,1],zeta.splines$splines)
dev.new()
Reg.ispline(response = zeta.tot$zeta.val[,1], predictor = zeta.tot$zeta.val[,2:3], lwd=2, cons=1)