Skip to contents

If the $save method has previously been invoked on a PM_result object that was changed, for example by using the $validate method, this function will load those results.

Arguments

file_name

The name of the .rds file to load.

Value

A PM_result object

Details

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

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.

Creation of new PM_result objects is via PM_load.

See makeNCA.

PM_result objects contain a save method which invokes saveRDS to write the object to the hard drive as an .rds file. This is the corresponding load function.

The saved object is an .rds file. When loaded, it should be assigned to an R object, e.g. run2 <- PM_result$load("filename"). This contrasts with loading unmodified results after a run, which is accomplished with PM_load.

Author

Michael Neely, Julian Otalvaro

Public fields

NPdata

List with all output from NPAG, made by NPparse

ITdata

List with all output from IT2B, made by ITparse

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

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 object will be added to the PM_result object. It contains 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.

Methods


Method new()

Create new object populated with data from previous run

Usage

PM_result$new(out, quiet = T, backend = "fortran")

Arguments

out

The parsed output from PM_load.

quiet

Quietly validate. Default is FALSE.

backend

Should the backend use Fortran ("fortran", default) or Rust ("rust")


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(type, ...)

Arguments

type

Type of AUC based on class of object

...

Summary-specific arguments


Method nca()

Perform non-compartmental analysis

Usage

PM_result$nca(...)

Arguments

...

Arguments passed to makeNCA.


Method sim()

Simulates using the self$final object. For parameter information refer to SIMrun. It will return a PM_sim object by running SIMparse at the end of the simulation.

Usage

PM_result$sim(...)

Arguments

...

Parameters passed to SIMrun


Method save()

Save the current PM_result object to an .Rdata file. This is useful if you have updated the result in some way, for example you have run the $make_valid 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 files can be loaded again with PM_load.

Usage

PM_result$save(run, file)

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".


Method validate()

Validate the result by internal simulation methods.

Usage

PM_result$validate(...)

Arguments

...

Arguments passed to make_valid.


Method step()

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

Usage

PM_result$step(...)

Arguments

...

Arguments passed to PMstep.


Method MM_opt()

Calculate optimal sample times from result and template data file.

Usage

PM_result$MM_opt(...)

Arguments

...

Arguments passed to MM_opt.


Method load()

This function loads an rds file created using the $save method on a PM_result object.

Usage

PM_result$load(file_name)

Arguments

file_name

Name of the file to be read, the default is "PMresult.rds".

Returns

A PM_result object.

Examples

\dontrun{newRes <- PM_result$load("PMresult.rds")}


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.

Examples


## ------------------------------------------------
## Method `PM_result$load`
## ------------------------------------------------

if (FALSE) newRes <- PM_result$load("PMresult.rds")