BreathTestPopulationFit: Breathtest population fit

Description Usage Arguments Value Author(s) Examples

View source: R/PopulationFit.R

Description

Fits a population nlme model to multiple breath test PDR records. First, separate nls fits are done to determine those records that do not give a valid fit. Technically it would be possible to fit these outliers with a population fit, but this leads to failure of the method quite often, so the simple outlier removal method was chosen. #' @name BreathTestPopulationFit

Usage

1

Arguments

x

data frame with columns BreathTestRecordID, Time, PDR. When no parameter is given, reads from default database via with function GetPopulationsData.

Value

data frame with columns BreathTestRecordID, m, k,beta of the population fit. Use function SavePopulationFit to save to database.

Author(s)

Dieter Menne, dieter.menne@menne-biomed.de

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
set.seed(14024)
sqliteFile = CreateSimulatedBreathTestDatabase()
con = OpenSqliteConnection(sqliteFile)
pd = GetPopulationData(con)
# Make one stupid outlier
pp = pd$PDR[pd$BreathTestRecordID=="1"]
pp = pp+(1:length(pp))*0.5
pd$PDR[pd$BreathTestRecordID==1] = pp
head(pd)
# This gives a "did not converge" error
cf = try(BreathTestPopulationFit(pd))
print(cf)
dbDisconnect(con)

dmenne/d13cbreath documentation built on March 1, 2020, 3:41 a.m.