Main Content

groupedData

Table-like collection of data and metadata for fitting in SimBiology

Description

The groupedData object is the required data format to store data needed for fitting using fitproblem, sbiofit, and sbiofitmixed. It is a table-like object with a few differences.

  • The groupedData object has two additional properties to identify the independent variable and an optional grouping variable.

  • The groupedData object has additional methods that let you create doses and variants from data set and convert a groupedData object to a table.

  • groupedData.Properties is a structure.

Creation

Description

grpData = groupedData creates an empty groupedData object.

example

grpData = groupedData(tbl) creates a groupedData object by copying a table or dataset object tbl. The GroupVariableName and IndependentVariableName properties of the grpData object are implicitly determined by looking for the first case-insensitive match to a list of variable names of tbl (tbl.Properties.VariableNames). For the grouping variable, the list of names is ID, Group, I, and Run. For the independent variable, the list of names is Time, T, and IDV. If there are no matches, GroupVariableName and IndependentVariableName are set to empty character vectors ''.

example

grpData = groupedData(tbl,groupVarName) sets the GroupVariableName property of the grpData object to groupVarName. The IndependentVariableName property is implicitly set as in the previous syntax.

example

grpData = groupedData(tbl,groupVarName,independentVarName) additionally sets the IndependentVariableName property of the grpData object to independentVarName.

example

Input Arguments

expand all

Data, specified as a table or dataset (Statistics and Machine Learning Toolbox).

Grouping variable name, specified as a character vector or string. An empty character vector '' or string "" indicates that there is no group variable.

Independent variable name, specified as a character vector or string. An empty character vector '' or string "" indicates that there is no independent variable.

Output Arguments

expand all

Grouped data, returned as a groupedData object.

Properties

expand all

The groupedData object supports all properties of table and provides the following additional properties.

Name of the grouping variable that indicates the groups in the data, specified as a character vector. To indicate that there are no groups (or just one group), set the property to the empty character vector ''.

Example: 'ID'

Name of the independent variable in the data such as time, specified as a character vector.

Example: 'TIME'

Object Functions

The groupedData object supports many functions of table. However, it does not support the math operations that the table supports, such as +, -, / , min, max, mean, and so on. To see a list of math operations that the table supports, see here. The groupedData object has the following additional functions.

createDosesCreate dose objects from groupedData object
createVariantsCreate variant objects from groupedData object
groupedData2tableConvert groupedData object to table

Examples

collapse all

Load the sample data set.

load pheno.mat ds

Create a groupedData object from the data set ds.

grpData = groupedData(ds);

Display the object properties.

grpData.Properties
ans = struct with fields:
                Description: ''
                   UserData: []
             DimensionNames: {'Observations'  'Variables'}
              VariableNames: {'ID'  'TIME'  'DOSE'  'WEIGHT'  'APGAR'  'CONC'}
              VariableTypes: ["double"    "double"    "double"    "double"    "double"    "double"]
       VariableDescriptions: {}
              VariableUnits: {}
         VariableContinuity: []
                   RowNames: {}
           CustomProperties: [1x1 matlab.tabular.CustomProperties]
          GroupVariableName: 'ID'
    IndependentVariableName: 'TIME'

GroupVariableName and IndpendentVariableName have been automatically assigned to 'ID' and 'Time', respectively.

Version History

Introduced in R2014a