Skip to contents

[Stable]

This object contains all of the results after a Pmetrics runs. It is created by using the PM_load function.

Details

After a run completes, results are stored on your hard drive. They are loaded back into R with PM_load to create the PM_result object, which contains both the results and functions to analyze or plot the result.

Author

Michael Neely, Julian Otalvaro

Public fields

pop

A PM_pop object

post

A PM_post object

final

A PM_final object

cycle

A PM_cycle object

op

A PM_op object

cov

A PM_cov object

data

PM_data object representing the original .csv data file used in the run. The predictions contained in the $data fields from $pop and $post will be added to this PM_data object to permit easy addition of such predictions to raw data plots. See plot.PM_data for more details.

model

text string representing the original model file used in the run

errfile

Name of error file if it exists

success

Boolean if successful run

valid

If the $validate method has been executed after a run, this field will contain the information required to plot visual predictive checks and normalized prediction error discrepancies via the npde code developed by Comets et al. Use the $save method on the augmented PM_result object to save it with the new validation results.

opt_samp

If the $opt method has been executed after a run, this field will contain a PM_opt object which has optimal sampling times and methods to plot them. Use the $save method on the augmented PM_result object to save it with the new optimal sampling results.

Methods


Method new()

Create new object populated with data from previous run

Usage

PM_result$new(out, path = ".", quiet = TRUE)

Arguments

out

The parsed output from PM_load, which is automatically generated. This is not a user-modifiable.

path

include Path to the folder containing the raw results of the run. Default is the current working directory. .

quiet

Quietly validate. Default is FALSE.

Details

Creation of new PM_result objects is via PM_load.


Method fit()

Fit the model to the data #' @details This method is used to fit the model in the PM_result object to data. It calls the $fit method of the model stored in the model field.

Usage

PM_result$fit(data, ...)

Arguments

data

Optional data to fit. If not provided, the data stored in the data field of the PM_result object will be used. This can be useful to continue a prior run that did not converge before the maximum number of cycles, e.g. run2 <- run1$fit(cycles = 10000, prior = 1)

...

Additional arguments passed to the model's $fit method.

Returns

Returns an invisible PM_result.


Method plot()

Plot generic function based on type

Usage

PM_result$plot(type, ...)

Arguments

type

Type of plot based on class of object

...

Plot-specific arguments


Method summary()

Summary generic function based on type

Usage

PM_result$summary(type, ...)

Arguments

type

Type of summary based on class of object

...

Summary-specific arguments


Method auc()

AUC generic function based on type

Usage

PM_result$auc(src, ...)

Arguments

src

Source of AUC, one of "op", "pop", "post", or "sim"

...

Summary-specific arguments


Method nca()

Perform non-compartmental analysis

Usage

PM_result$nca(...)

Arguments

...

Arguments passed to makeNCA.

Details

See makeNCA.


Method report()

Re-generate the report

Usage

PM_result$report(...)

Arguments

...

Parameters passed to PM_report. In particular, pay attention to path.


Method sim()

Calls PM_sim. Default is to use the $final, $model, and $data objects within the PM_result. It is common to supply a different data template. Occasionally it is necessary to use a different model with the $final field, or vice versa. If all three are different, use PM_sim$new() instead.

Usage

PM_result$sim(...)

Arguments

...

Parameters passed to PM_sim. If using the $final, $model, and $data fields, it is not necessary to specify these. Alternates for any of these should be specified. Other parameters for PM_sim should be passed as named arguments, e.g. $sim(include = 1:2, predInt = 1, limits = NA).


Method save()

Save the current PM_result object to an .Rdata file.

Usage

PM_result$save(run, file = "PMout.Rdata")

Arguments

run

The run output folder number to save the revised result. If missing, will save in the current working directory. For example, if folder "1" is in your current working directory, specify run = 1 to save the result to the "outputs" subfolder of the "1" folder.

file

Custom file name. Default is "PMout.Rdata". If run is not specified, file should be the full path and filename.

Details

This is useful if you have updated the result in some way, for example you have run the $validate() method on the PM_result object, which returns an internal simulation based validation as a new valid field. To save this validation, use this $save method. Note that unless a file name is provided, the changes will overwrite the previous run results, although unchanged items will be preserved. This is the usual workflow. However, a custom file name may be useful to share the run results with someone.

The saved object is an .Rdata file. When loaded, it should be assigned to an R object, e.g. run2 <- PM_result$new("filename"). An equivalent statement would be run2 <- PM_load(file = "filename").


Method validate()

Validate the result by internal simulation methods.

Usage

PM_result$validate(...)

Arguments

...

Arguments passed to PM_valid.


Method step()

Conduct stepwise linear regression of Bayesian posterior parameter values and covariates.

Usage

PM_result$step(...)

Arguments

...

Arguments passed to PM_step.


Method opt()

Calculate optimal sampling times.

Method to compute optimal sampling times.

Usage

PM_result$opt(...)

Arguments

...

Parameters to pass to PM_opt.

Details

See PM_opt for details.


Method load()

[Deprecated]

Deprecated method to load prior results saved with the $save method. Replaced by PM_load.

Usage

PM_result$load(...)

Arguments

...

Not used.


Method continue()

Continue fitting the model to the data using the final population points from the prior run as the prior for the new run.

Usage

PM_result$continue(...)

Arguments

...

Additional arguments passed to the underlying fit method of the model. See the documentation for fit for details on supported parameters.

Details

This method is useful if a prior run did not converge before the maximum number of cycles. It uses the final population points from the prior run as the prior for a new run. The data and model are the same as in the prior run.


Method clone()

The objects of this class are cloneable with this method.

Usage

PM_result$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.