Learn R Programming

RMark (version 3.0.0)

run.mark.model: Runs analysis with MARK model using MARK.EXE

Description

Passes input file from model (model$input) to MARK, runs MARK, gets output and extracts relevant values into results which is appended to the mark model object.

Usage

run.mark.model(
  model,
  invisible = FALSE,
  adjust = TRUE,
  filename = NULL,
  prefix = "mark",
  realvcv = FALSE,
  delete = FALSE,
  external = FALSE,
  threads = -1,
  ignore.stderr = FALSE
)

Value

model: MARK model object with the base filename stored in output and the extracted results from the output file appended onto list; see mark for a detailed description of a mark object.

Arguments

model

MARK model created by make.mark.model

invisible

if TRUE, exectution of MARK.EXE is hidden from view

adjust

if TRUE, adjusts number of parameters (npar) to number of columns in design matrix, modifies AIC and records both

filename

base filename for files created by MARK.EXE. Files are named filename.*.

prefix

base filename prefix for files created by MARK.EXE; the files are named prefixnnn.*

realvcv

if TRUE the vcv matrix of the real parameters is extracted and stored in the model results

delete

if TRUE the output files are deleted after the results are extracted

external

if TRUE the mark object is saved externally rather than in the workspace; the filename is kept in its place

threads

number of cpus to use with mark.exe if positive or number of cpus to remain idle if negative

ignore.stderr

If set TRUE, messages from mark.exe are suppressed; they are automatically suppressed with Rterm

Author

Jeff Laake

Details

This is a rather simple function that initiates the analysis with MARK and extracts the output. An analysis was split into two functions make.mark.model and run.mark.model to allow a set of models to be created and then run individually or collectively with run.models. By default, the execution of MARK.EXE will appear in a separate window in which the progress can be monitored. The window can be suppressed by setting the argument invisible=TRUE. The function returns a mark object and it should be assigned to the same object to replace the original model (e.g., mymodel=run.mark.model(mymodel)). The element output is the base filename that links the objects to the output files stored in the same directory as the R workspace. To removed unneeded output files after deleting mark objects in the workspace, see cleanup. results is a list of specific output values that are extracted from the output. In extracting the results, the number of parameters can be adjusted (adjust=TRUE) to match the number of columns in the design matrix, which assumes that it is full rank and that all of the parameters are estimable and not confounded. This can be useful if that assumption is true, because on occasion MARK.EXE will report an incorrect number of parameters in some cases in which the parameters are at boundaries (e.g., 0 or 1 for probabilities). If the true parameter count is neither that reported by MARK.EXE nor the number of columns in the design matrix, then it can be adjusted using adjust.parameter.count.

If filename is assigned a value it is used to specify files with those names. This is most useful to capture output from a model that has already been run. If it finds the files with those names already exists, it will ask if the results should be extracted from the files rather than re-running the models.

See Also

make.mark.model, run.models, extract.mark.output, adjust.parameter.count, mark, cleanup

Examples

Run this code
# \donttest{
# This example is excluded from testing to reduce package check time
test=function()
{
  data(dipper)
  for(sex in unique(dipper$sex))
  {
	  x=dipper[dipper$sex==sex,]
	  x.proc=process.data(x,model="CJS")
	  x.ddl=make.design.data(x.proc)
	  Phi.dot=list(formula=~1)
	  Phi.time=list(formula=~time)
	  p.dot=list(formula=~1)
	  p.time=list(formula=~time)
	  cml=create.model.list("CJS")
	  x.results=mark.wrapper(cml,data=x.proc,ddl=x.ddl,prefix=sex,delete=TRUE)
	  assign(paste(sex,"results",sep="."),x.results)
  }
  rm(Male.results,Female.results,x.results)
}
test()
cleanup(ask=FALSE,prefix="Male")
cleanup(ask=FALSE,prefix="Female")
# }

Run the code above in your browser using DataLab