TuningCorr_df: TuningCorr_df - Automated correction of PAM using tuned mean...

Description Usage Arguments Details Value Note Author(s) Examples

View source: R/TuningCorr_df.R

Description

uses the mean based on the data clipped by 'Whisker' and 'Quantil' for specified subgroups to correct the PAM values.

Usage

1
TuningCorr_df(df, att1 = NULL, att2 = NULL, tuning = NULL, threshold = NULL)

Arguments

df

data.frame - containing Control and PAM values with colnames "CTR" and "PAM"

att1

character - Column name of data frame which should be used to correct by mean. If missing, will use the global mean to correct PAM.

att2

character - Additional column name of data frame which should be used to correct by mean. Only necessary if the correction should use subgroups for the data in 'pos1'

tuning

character - method for clipping the data used to calculate the mean. Methods can be "whisker", "quantil" or "threshold". If 'NULL' will perform no tuning. Default= NULL.

threshold

numeric - specifies the threshold to clip values for tuning. Only needed if 'tuning' == "threshold".

Details

Value

returns a data.frame with an additional column "PAM_corr" with the corrected PAM values and prints the respective mean values for each class or combination of classes. Uses 'tuned' data to calculate the mean values.

Note

If used without any attributes will use the global mean over all values to correct PAM. IF 'att1' is set will calculate the mean for each group in 'att1' to correct PAM. IF 'att2' is given will use the mean for each group with the combination for each attribute.

Author(s)

Andreas Schönberg

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# load data
dat <- read.csv(system.file("extdata","exp_PAM.csv",package = "PAMcorrection"))
head(dat)

# how the tuning works ("whisker" and "quantil")
bp <-boxplot(dat$PAM-dat$CTR)
bp$stats[1,1] # lower whisker
bp$stats[2,1] # lower quantil
bp$stats[3,1] # median
bp$stats[4,1] # upper quantil
bp$stats[5,1] # upper whisker

# correct df by global means
corrected <-TuningCorr_df(dat,tuning = "whisker")
corrected <-TuningCorr_df(dat,tuning = "quantil")

# use one class (no tuning)
corrected <-TuningCorr_df(dat,att1 = "dilect")
# use one class with threshold tuning
corrected <-TuningCorr_df(dat,att1 = "dilect",tuning="threshold",threshold=0.8)
# use two classes (means for each generation depending on dilect) tuned by 'whisker'
corrected <-TuningCorr_df(dat,att1 = "generation",att2 = "dilect",tuning = "whisker")

SchoenbergA/PAMcorrection documentation built on Jan. 28, 2022, 6:09 a.m.