oadaAICtable: Fit a set of OADA models for multi-model inference

Description Usage Arguments Details Value print(oadaAICtable) components oadaAICtable components See Also

View source: R/oadaAICtable.R

Description

oadaAICtable takes diffusion data in the form of an nbdaData object (nbdaData) or a list of nbdaData objects (for multiple diffusions). It then fits a set of models using oadaFit and return them in an object of class oadaAICtable. Arguments not described below are used internally by combineOadaAICtables when making calls to oadaAICtable and can be ignored by the user.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
oadaAICtable(nbdadata, constraintsVectMatrix, typeVect = NULL,
  offsetVectMatrix = NULL, cores = 1, modelsPerCorePerSet = NULL,
  writeProgressFile = F, saveTableList = F, statusBar = NULL,
  startValue = NULL, method = "nlminb", gradient = T,
  iterations = 150, aicUse = "aicc", lowerList = NULL,
  upperList = NULL, combineTables = F, MLEs = NULL, SEs = NULL,
  MLEilv = NULL, SEilv = NULL, MLEint = NULL, SEint = NULL,
  convergence = NULL, loglik = NULL, aic = NULL, aicc = NULL,
  netComboModifierVect = "", saveModels = F, stripData = F,
  models = NULL)

Arguments

nbdadata

an object of class (nbdaData) to fit models to a single diffusion or a list of nbdaData objects to fit a model to multiple diffusions.

constraintsVectMatrix

a numerical matrix specifying the constraints, with each row specifiying a model to be fitted. The number of columns is equal to the number of parameters in the (nbdaData) object(s) input to argument nbdadata. Each row then specifies the constraintsVect to be passed to the constrainedNBDAdata when creating the data object(s) to which that model is fitted.

typeVect

optional character vector specifying if each model is "asocial" or "social". However, it is not usually necessary to specify, since models with all s parameters constrained =0 are automatically classified as "asocial", and others are assumed to be "social".

offsetVectMatrix

an optional numerical matrix specifying the offsets, with each row specifiying the offsets for each model to be fitted. The number of columns is equal to the number of parameters in the (nbdaData) object(s) input to argument nbdadata. Each row then specifies the offsetVect to be passed to the constrainedNBDAdata when creating the data object(s) to which that model is fitted.

cores

numerical giving the number of computer cores to be used in parallel to fit the models in the set, thus speeding up the process. By default set to 1. For a standard desktop computer at the time of writing 4-6 is advised.

modelsPerCorePerSet

optional numerical. If specified the models can be fit in sets, and a progress file written after each set is completed. This means progress is not completely lost in the case of a crash/ powercut etc. For example, if we have 400 models, we can specify cores=4 and modelsPerCorePerSet=10. This means 10 models are fitted on each core, then progress is saved with the first 40 models, then the next 40 and so on.

writeProgressFile

logical. If set to T, a file is written to the working directory when each set of models have been completed with the oadaAICtable for the models fitted so far. In the event of a crash, the remining models can be fitted as a separate set, then combined using combineOadaAICtables.

saveTableList

logical. If set to T, a file is written to the working directory containing a list of oadaAICtable objects- one for each set of models per core (see modelsPerCorePerSet). This is useful if there is an error in one or more of the models preventing the oadaAICtable from being calculated properly. In this case the set(s) containing the faulty model can be corrected, refitted using oadaAICtable, and replaced in the list. The oadaAICtable can then be reformed using combineOadaAICtables.

statusBar

optional logical. Status bar only works when cores=1.

startValue

optional numeric vector giving start values for the maximum likelihood optimization. Length to match the number of parameters fitted in the full model.

method

optional character string passed to oadaFit.

gradient

optional logical passed to oadaFit.

iterations

optional numerical passed to oadaFit.

aicUse

string specifying whether to use "aicc" or "aic".

lowerList

optional numeric matrix giving lower values for the maximum likelihood optimization for each model. Columns to match the number of parameters fitted in the full model, rows matched to the number of models. Can be used if some models have convergence problems or trigger errors.

upperList

optional numeric matrix giving upper values for the maximum likelihood optimization for each model. Columns to match the number of parameters fitted in the full model, rows matched to the number of models. Can be used if some models have convergence problems or trigger errors.

combineTables

logical used internally by combineOadaAICtables when making calls to oadaAICtable.

saveModels

logical determining whether the fitted model objects should be saved as a list as a component in the oadaAICtable object. This can be useful for accessing individual models without re-fitting them (e.g. to get confidence intervals using profLikCI). Alternatively individual problem models can be refitted, replaced in the list, and the oadaAICtable re-generated using oadaAICtable using the models argument (see below).

stripData

logical. By default, when saveModels=T each model is saved with its constrained version of the data. Whilst this can be useful, if there are lots of models and/or a lot of data, this can take up too much memory. setting saveModels=T and stripData=T enables the models to be saved without their data.

models

an optional list of model objects of class oadaFit. If provided, the models are not fitted but taken from the list when generating the oadaAICtable. This is useful if individual models have been corrected and the user needs to re-form the oadaAICtable.

Details

Each row of constraintsVectMatrix and offsetVectMatrix determines a model to be fitted. For each row, constrained nbdaData objects are created using (constrainedNBDAdata) with constraintsVect=constraintsVectMatrix[i,] and offsetVect=offsetVectMatrix[i,]. A model is then fitted to the nbdaData object(s) using oadaFit.

Value

An object of class oadaAICtable.

print(oadaAICtable) components

A data.frame giving a summary of models ordered by AIC can be obtained using print(<name of oadaAICtable>). This has the following columns, listed in order:

model

Model number, i.e. the row of constraintsVectMatrix used to generate the model.

type

Type of model. noILVs, additive (ILV effects on asocial learning only), multiplicative (all ILVs have same effect on asocial and social learning), unconstrained (differing effects on asocial and social learning for at least one ILV), socialEffectsOnly (ILV effects only on social learning),asocial

netcombo

A representaion of the network effects present in the model, i.e. the constraints on the s parameters. See constrainedNBDAdata.

baseline

Used for TADA models only, set to NA here.

CONS.

The constraint on each parameter, as taken from constraintsVectMatrix

OFF

The offset on each parameter, as taken from offsetVectMatrix

convergence

Was convergence reported by the optimization algorithm?

loglik

-log-likelihood for the model.

s...

Maximum likelihood estimates for s parameters.

ASOCIAL...

Maximum likelihood estimates for effects of ILVs on asocial learning.

SOCIAL...

Maximum likelihood estimates for effects of ILVs on social learning.

ASOCIAL:SOCIAL...

Maximum likelihood estimates for multiplicative effects of ILVs see oadaFit.

SE...

Standard errors for each parameter, set to 0 when a parameter was constrained. See oadaFit.

aic

AIC for the model.

aicc

AICc for the model.

deltaAICc

Difference in AICc or AIC from the best model.

RelSupport

Relative support for the model compared to the best model, calculated as exp(-0.5*deltaAICc).

AkaikeWeight

Akaike weight for the model. Can be interpretted as the probability that model has the highest predictive power (K-L information) out of the set of models considered.

oadaAICtable components

@nbdadata

The unconstrained data the model is fitted to, as a list of nbdaData objects.

@models

A list of fitted model objects of class oadaFit, if saved.

@convergence

Was convergence reported by the optimization algorithm? (Ordered by constraintsVectMatrix).

@logLik

-log-likeihood for models (ordered by constraintsVectMatrix).

@aicc

AICc for models (ordered by constraintsVectMatrix).

@aic

AIC for models (ordered by constraintsVectMatrix).

@constraintsVectMatrix

constraintsVectMatrix input to the function.

@offsetVectMatrix

offsetVectMatrix input to the function.

@MLEs

Maximum likelihood estimates for s parameters (ordered by constraintsVectMatrix).

@SEs

Standard errors for s parameters (ordered by constraintsVectMatrix).

@MLEilv

Maximum likelihood estimates for effect of ILs on asocial learning (ordered by constraintsVectMatrix).

@SEilv

Standard errors for effect of ILs on asocial learning (ordered by constraintsVectMatrix).

@MLEint

Maximum likelihood estimates for effect of ILs on social learning (ordered by constraintsVectMatrix).

@SEint

Standard errors for effect of ILs on social learning (ordered by constraintsVectMatrix).

@typeVect

Type of models (ordered by constraintsVectMatrix).

@deltaAICc

Difference in AICc or AIC from the best model. (ordered by constraintsVectMatrix).

@RelSupport

Relative support for the model compared to the best model, calculated as exp(-0.5*deltaAICc). (ordered by constraintsVectMatrix).

@RelSupport

Akaike weight for the model. (ordered by constraintsVectMatrix).

@printTable

data.frame to be output by the print method for oadaAICtable (see above).

See Also

typeSupport, networksSupport, typeByNetworksSupport, modelAverageEstimates, variableSupport, unconditionalStdErr, combineOadaAICtables. For TADA models use tadaAICtable.


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