calcmodel {MorphoRegions} | R Documentation |
calcmodel()
fits a multivariate segmented regression model using the supplied PCOs and breakpoints.
calcmodel(x, scores, bps, cont = TRUE)
x |
a |
scores |
|
bps |
|
cont |
|
A regions_results_single
object, which contains the results of the model (breakpoints and RSS of each PCO and overall) and model support statistics.
calcregions()
and addregions()
for computing all possible models instead of just a single one; plotsegreg()
, for which the plot
method is an alias, for plotting the fitted regression lines; modelsupport()
for interpreting the model support statistics.
data("alligator")
alligator_data <- process_measurements(alligator,
pos = "Vertebra")
# Compute PCOs
alligator_PCO <- svdPCO(alligator_data)
# Calculate a single segmented regression model
# using first 2 PCOs and a discontinuous model
regionsmodel <- calcmodel(alligator_PCO,
scores = 1:3,
bps = c(8, 16, 21),
cont = FALSE)
regionsmodel
#Evaluate performance (R2) on that model
modelperf(regionsmodel)
#Plot model results:
plotsegreg(regionsmodel, scores = 1:3)