constrainedNBDAdata: Put parameter constraints on an nbdaData object or dTADAData...

Description Usage Arguments Details Value Warning See Also

View source: R/constrainedNBDAdata.R

Description

Takes an object of class nbdaData or dTADAData and adds constraints to the parameters such that a simpler model can be fitted. Offsets can also be added.

Usage

1
constrainedNBDAdata(nbdadata, constraintsVect, offsetVect = NULL)

Arguments

nbdadata

an object of class nbdaData or dTADAData

constraintsVect

a numerical vector specifying the constraints to be applied to the data object, of length matching the number of parameters to be fitted in the correspondng OADA model (i.e. excluding baseline parameters for a TADA). Constraints are specified for s parameters, then asoc_ilv, then int_ilv, then multi_ilv. If a paramter is assigned a value of zero, it is constrained to have a value of zero (other values are then possible using offsetVect below. Non-zero parameters are then assigned a integer increasing from 1. Parameters assigned the same number are constrained to have the same value. e.g. If we have an ndbaData object with 3 networks, 3 asoc_ilv, 3 int_ilv and 1 multi_ilv: constraintsVect=c(0,1,1,2,2,0,3,4,0,5) constrains the first network to have no effect (s1=0), equivalent to removing it from the model. The second two networks are constrained to have the same effect per unit connection (s2=s3). The first and second ILVs in asoc_ilv are constrained to have the same effect, the third ILV in asoc_ilv is removed. The first and second ILVs in int_ilv are unconstrained, and the third ILV is again removed. Finally the only multi_ilv remains unconstrained. Note that parameters of different types cannot be constrained to have the same value, i.e. constraints must be within the s parameters, asoc_ilv, int_ilv or multi_ilv categories. However, an ILV can be constrained to have the same effect on asocial and social learning by creating a new object using nbdaData or dTADAData, removing it from asoc_ilv and int_ilv and adding it to multi_ilv.

offsetVect

an optional numerical vector specifying the offsets to be applied to the data object, of length matching the number of parameters to be fitted in the correspondng OADA model (i.e. excluding baseline parameters for a TADA). An offset is a coefficient for a predictor variable that is fixed to have a specific value, i.e. not fitted to the data. When combined with an appropriate constraintsVect, offsetVect can be used to create a number of useful constrained models. e.g. If we have an ndbaData object with 3 networks and 3 asoc_ilvs, we can use constraintsVect=c(0,1,2,3,4,5) and offsetVect=c(2,0,0,0,0,0) and create a model in which s1 is constrained to have a value of s1=2. This works because constraintsVect constrains s1=0 and then offsetVect adds an offset of 2 to s1. This method is used internally by profLikCI to calculate confidence intervals for a specific parameter. Furthermore, we can create models in which two parameters are constrained to differ by a specific amount: e.g. If we have an ndbaData object with 3 networks and 3 asoc_ilvs, we can use constraintsVect=c(1,2,2,3,4,5) and offsetVect=c(0,0,1,0,0,0) and create a model in which s3 is constrained to have a value of s3=s2+1. This works because constraintsVect constrains s2=s3 and then offsetVect adds an offset of 1 to s3. This method is used internally by profLikCI to calculate confidence intervals for the difference bewteen two parameters.

Details

Since the contents of the nbdaData or dTADAData object determine the form of an OADA or TADA fitted using oadaFit or tadaFit, parameter constraints are made by applying them to the data object. This is done by specifying a numerical vector constraintsVect and optionally, a numerical vector offsetVect that specifies the offset added to each parameter (see arguments above).

Value

An object of class nbdaData or dTADAData depending on the input data.

Warning

constrainedNBDAdata cannot be used directly to fit a model with NO social effects, i.e. ALL s parameters constrained. To do this, use constrainedNBDAdata to create an object with the required constraints among the ILVs, then fit a model with type="asocial". To constrain all s paramter to have a specific values, add an offsetVect using constrainedNBDAdata then fit the model with type="asocial".

See Also

filteredNBDAdata, nbdaData, dTADAData.


whoppitt/NBDA documentation built on April 25, 2021, 7:55 a.m.