An S4 class that represents a collection of variables
An S4 class that represents a collection of variables
It will multiply the numeric vector with both the constant and the variable in 'LinearVariableSum'
It will multiply the numeric vector with both the constant and the variable in 'LinearVariableSum'
Equivalent to e1 + -1 * e2
Equivalent to (-1 * e2) - (-1 * e1)
Add two object of 'LinearVariableSum'. I.e. variables + constants
Equivalent to e1 + (-1) * e2
Adds the variables in the rhs to the variables in the lhs and returns another 'LinearVariableSum'.
Equivalent to e2 + e1
Equivalent to -1 * (e2 - e1)
Equivalent to e1 + -1 * e2
Adds a constant (rhs) to constant slot of the lhs object.
Equivalent to e2 + e1
Equivalent to e1 * (-1)
Equivalent to e1 * (-1)
Equivalent to e1
Equivalent to e1
Adds a constant numeric vector to a variable. The constant needs to be a vector of length 1.
Equivalent to e2 + e1
Equivalent to e1 + -1 * e2
Equivalent to (-1 * e2) - (-1 * e1)
Equivalent to e1 * (1 / e2)
Equivalent to e1 * (1 / e2)
Adds two variables together. Same values for variable, row and col will be added. Everything else merged.
Equivalent to e1 + -1 * e2
Multiplies the coefficients rowwise with a given numeric vector. If the numeric vector is a linear_transposed_vector, it will multiply the vector with each variable per row.
Equivalent to e2 * e1
This creates a new variable collection as a subset of the previously defined indexed variable. A variable collection essentially is a data frame having values for rows and columns of the final model matrix.
class
## S4 method for signature 'LinearVariableSum,numeric'e1 * e2
## S4 method for signature 'numeric,LinearVariableSum'e1 * e2
## S4 method for signature 'LinearVariableSum,numeric'e1 - e2
## S4 method for signature 'numeric,LinearVariableSum'e1 - e2
## S4 method for signature 'LinearVariableSum,LinearVariableSum'e1 + e2
## S4 method for signature 'LinearVariableSum,LinearVariableSum'e1 - e2
## S4 method for signature 'LinearVariableSum,LinearVariableCollection'e1 + e2
## S4 method for signature 'LinearVariableCollection,LinearVariableSum'e1 + e2
## S4 method for signature 'LinearVariableCollection,LinearVariableSum'e1 - e2
## S4 method for signature 'LinearVariableSum,LinearVariableCollection'e1 - e2
## S4 method for signature 'LinearVariableSum,numeric'e1 + e2
## S4 method for signature 'numeric,LinearVariableSum'e1 + e2
## S4 method for signature 'LinearVariableSum,missing'e1 - e2
## S4 method for signature 'LinearVariableCollection,missing'e1 - e2
## S4 method for signature 'LinearVariableSum,missing'e1 + e2
## S4 method for signature 'LinearVariableCollection,missing'e1 + e2
## S4 method for signature 'LinearVariableCollection,numeric'e1 + e2
## S4 method for signature 'numeric,LinearVariableCollection'e1 + e2
## S4 method for signature 'LinearVariableCollection,numeric'e1 - e2
## S4 method for signature 'numeric,LinearVariableCollection'e1 - e2
## S4 method for signature 'LinearVariableCollection,numeric'e1 / e2
## S4 method for signature 'LinearVariableSum,numeric'e1 / e2
## S4 method for signature 'LinearVariableCollection,LinearVariableCollection'e1 + e2
## S4 method for signature 'LinearVariableCollection,LinearVariableCollection'e1 - e2
## S4 method for signature 'LinearVariableCollection,numeric'e1 * e2
## S4 method for signature 'numeric,LinearVariableCollection'e1 * e2
## S4 method for signature 'LinearVariableCollection,ANY,ANY,missing'x[i, j,..., drop =TRUE]
Arguments
e1: a numeric value
e2: an object of type 'LinearVariableCollection'
x: an object of type 'LinearVariableCollection'
i: a numeric vector or a colwise vector/list
j: a numeric vector or a colwise vector/list
...: more a numeric vectors or a colwise vector/list
drop: do not use this parameter
Returns
Returns an object of type 'LinearVariableSum'
Returns an object of type 'LinearVariableSum'
Returns an object of type 'LinearVariableSum'
an object of type 'LinearVariableSum'
a new object of type 'LinearVariableCollection'
Slots
variables: a data frame hold the variable coefficients. One line for reach variable, row and column.
index_mapping: a function that takes a variable name as character and returns a mapping table that maps column ids to variable indexes.
variable: a linear variable collection with just one index '1'
constant: a numeric vector
variables: a variable collection
Examples
## Not run:# vectors create matrix rows# x[1, 1]# x[2, 1]# x[3, 1]x[1:3,1]# colwise() creates columns per row# 1 * x[1, 1] + 2 * x[1, 2] + 3 * x[1, 3]colwise(1,2,3)* x[1, colwise(1,2,3)]# you can also combine the two# x[1, 1]# x[2, 1] + x[2, 2]# x[3, 1] + x[3, 2] + x[3, 2]x[1:3, colwise(1,1:2,1:3)]## End(Not run)