compact
Description
returns the compact censored linear regression model compactMdl = compact(mdl)compactMdl, which
is the compact version of the full, fitted censored linear regression model
mdl.
Examples
Load the censored readmissiontimes data.
load readmissiontimesThe variables Age, Weight, Smoker, and ReadmissionTime contain data for patient age, weight, smoking status, and time of readmission. The Censored variable contains censoring information for ReadmissionTime.
Save Age, Weight, Smoker, and ReadmissionTime in a table, and fit a censored linear regression model to the data.
tbl = table(Age,Weight,Smoker,ReadmissionTime); mdl = fitlmcens(tbl,Censoring=Censored)
mdl =
Censored linear regression model
ReadmissionTime ~ 1 + Age + Weight + Smoker
Estimated Coefficients:
Estimate SE tStat pValue
_________ ________ ________ __________
(Intercept) 27.74 3.4008 8.1569 1.4048e-12
Age -0.053476 0.059514 -0.89854 0.37117
Weight -0.11101 0.016823 -6.5986 2.3484e-09
Smoker -2.3455 0.93105 -2.5192 0.013434
Sigma: 4.068
Number of observations: 100, Error degrees of freedom: 95
25 right-censored observations
75 uncensored observations
Likelihood ratio statistic vs. constant model: 45, p-value = 9.27e-10
mdl is a CensoredLinearModel object that contains the results of fitting a linear model to the censored data.
Compact the model.
compactMdl = compact(mdl);
The compact model discards the original sample data and some information related to the fitting process.
Compare the size of the full model mdl and the compact model compactMdl.
vars = whos("compactMdl","mdl"); [vars(1).bytes,vars(2).bytes]
ans = 1×2
5449 14313
The compact model uses less memory than the full model.
Input Arguments
Censored linear regression model, specified as a CensoredLinearModel object created using fitlmcens.
Output Arguments
Compact censored linear regression model, returned as a CompactCensoredLinearModel
object.
A CompactCensoredLinearModel object uses less memory than a
CensoredLinearModel object because a compact model does not store the
input data used to fit the model or information related to the fitting process. You can
still use a compact model to predict responses using new input data, but some
CensoredLinearModel object functions do not work with a compact
model.
Version History
Introduced in R2025a
See Also
CompactCensoredLinearModel | CensoredLinearModel | fitlmcens
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)