Description Usage Arguments Details Value See Also Examples
View source: R/summary.FemFit.R
A summary method for segmented "FemFit" objects.
1 2 3 4 5 6 | ## S3 method for class 'FemFit'
summary(x, response = c("zeroPrssr", "prssr_sensor"),
descriptives = list(pfmc3x5s_rest30s = list("Lin.Trend"), rapid_pfmc15s =
list("Count+Peak"), two_and_triple_cough_rest10s = list("Max"),
valsalva3x6s_rest30s = list("Lin.Trend")), toPrint = TRUE,
sprintf_Format = "%4.2f", ...)
|
x |
An "FemFit" object. |
response |
Specifies which response to work with when calculating the descriptives. Must be set to "zeroPrssr" or "prssr_sensor". |
descriptives |
A list object containing the descriptives to calculate for each event within a JSONLabel. See Details. |
toPrint |
A logical constant which controls whether to print the summary output. |
sprintf_Format |
A character constant which formats the numeric output the printed summary output. |
... |
Other arguments not used by this method. |
The "FemFit" object must be segmented to have events within the protocol information. That is, the trLabel
column has "event"
entries within the JSONLabel
s of interest.
The list object for descriptives
is formatted such that the name of the JSONLabel
is associated with the list of descriptives to generate for the events within the JSONLabel
.
Options that are provided by summary
are:
"Lin.Trend"
to estimate the linear trend (and intercept) of an event. Prints the linear trend in terms of a second change, rather than in terms of a millisecond change.
"Count+Peak"
to estimate the number of peaks in principal component space and the maximal pressure of each peak by sensor. Prints the number of peaks and the mean maximal pressure by sensor.
"Count+PeakBySensor"
to estimate the number of peaks by sensor and the maximal pressure of each peak by sensor. Prints the number of peaks and the mean maximal pressure by sensor.
"Max"
to estimate the maximal pressure by sensor.
If not specificed, it defaults to estimating the mean pressure by sensor.
toPrint
and sprintf_Format
only uses the first element if there is a vector input.
Silently returns a tibble object.
sprintf
for possible formatting options to apply to numeric output.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | AS005 = read_FemFit(c(
"Datasets_AukRepeat/61aa0782289af385_283_csv.zip",
"Datasets_AukRepeat/61aa0782289af385_284_csv.zip"
),
remove.NAs = TRUE
) %>%
# Segment the FemFit data
segment(
cp. = 0.001,
numOfNodesToLabel = list(c(3, 1, 3, 4), c(4, 1, 5, 3))
) %>%
# Calculate the zeroed out pressures
deriveZero(method = "lmm")
# Extract the descriptives with the default arguments
summary(AS005)
# An example of specifying descriptives
summary(AS005, descriptives = list(
"rapid_pfmc15s" = list("Lin.Trend", "Count+Peak", "Count+PeakBySensor"))
)
# Define a function to extract the median pressure of an event trace
medianWrap = function (x) {
# The `toPrint` element tells `summary.FemFit` what to print
# Whereas the `toReturn` element which is a `list` object, tells `summary.FemFit` what to silently return.
dplyr::tibble(toPrint = median(x), toReturn = list(median(x)))
}
# Define a function to extract the robust regression linear trend
library(MASS)
Robust.Lin.Trend = function (x) {
# Append the time component in ms to the vector
x.df = data.frame(x = x, time = 0:(length(x) - 1) * 10)
# Fit the linear model with robust regression
x.fit = MASS::rlm(x ~ time, data = x.df)
# Print the coefficient in terms of a second change rather than a ms change
# Return the intercept and linear trend coefficients with their std. errors
dplyr::tibble(toPrint = 1000*coef(x.fit)[2], toReturn = list(summary(x.fit)$coefficients[, 1:2]))
}
# An example of specifying a user-defined function to generate a descriptive
# Instead of supplying a character input, a list input is used
# The list has three elements
# The first is the function used to generate the descriptive
# The second tells `summary.FemFit` whether to apply by sensor all to all sensors
# The third tells `summary.FemFit` what to name the descriptive
summary(AS005, descriptives = list(
"pfmc3x5s_rest30s" = list(
"Lin.Trend",
list(medianWrap, bySensor = TRUE, name = "Median"),
list(Robust.Lin.Trend, bySensor = TRUE, name = "Robust Lin.Trend")
)
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.