Title: | Center of Gravity Methods |
---|---|
Description: | Implementation of the Centre of Gravity method and the Extrapolated Centre of Gravity method. It supports replicated observations. Cameron, D.G., et al (1982) <doi:10.1366/0003702824638610> JCGM (2008) <doi:10.59161/JCGM100-2008E>. |
Authors: | Hugo Gasca-Aragon [aut, cre] |
Maintainer: | Hugo Gasca-Aragon <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.5.2 |
Built: | 2024-10-30 09:20:25 UTC |
Source: | CRAN |
Estimates the local minimum of a series or readings by the center of gravity and the extrapolated center of gravity.
Package: | ECG |
Type: | Package |
Version: | 0.5.1 |
Date: | 2024-10-01 |
License: | GPL (>= 3) |
Define a series of readings of a series as a data frame object containing: (date of reading, independent variable, replicated observations for control, replicated observations for unknown) Then estimate the minimum by analysing its profile with the CGr method, Optionally estimate the extrapolated minimum by analysisng its profile with the ECGr method.
H. Gasca-Aragon
Maintainer: H. Gasca-Aragon <[email protected]>
JCGM 100:2008. Guide to the expression of uncertainty of measurement.
Cameron et al. Precision in Condensed Phase Vibrational Spectroscopy, Applied Spectroscopy, Vol 36, Number 3, 1982.
Generic method for assessing an estimate against a reference value by the En index.
assess(x, y, x.B = list(u=0, dof=Inf), alpha=0.05)
assess(x, y, x.B = list(u=0, dof=Inf), alpha=0.05)
x |
a Estimator object |
y |
a list with the reference value (x, u, dof) |
x.B |
a list with the estimate of uncertainty type B for the x object and its degrees of freedom |
alpha |
numeric, the level of significance used to compute the coverage factor and the expanded uncertainty |
the numeric value of the En index evaluation. This is a normalized error value with expanded uncertainty equals 1.0.
H. Gasca-Aragon
Evaluates the CGdata object estimation against a reference value by the En index.
## S3 method for class 'CGdata' assess(x, y, x.B=list(u=0, dof=Inf), alpha=x$input$alpha)
## S3 method for class 'CGdata' assess(x, y, x.B=list(u=0, dof=Inf), alpha=x$input$alpha)
x |
a CGdata object |
y |
a list with the reference value (x, u) |
x.B |
a list with the estimate of uncertainty type B for the x object and its degrees of freedom |
alpha |
a numeric, the level of significance to compute the coverage factor and expanded uncertainty |
the numeric value of the En index evaluation. This is a normalized error value with expanded uncertainty equals 1.0.
H. Gasca-Aragon
require(ECG) N<- 1000 set.seed(12345) d1<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4)+rnorm(5/2*N, 0, 0.01) dat<- data.frame(x=1:length(d1), y=100*(d1-min(d1))/(max(d1)-min(d1))) CGres<- CGdata(dat) X.ref <- list(x=1250, u=0, dof=Inf) assess(CGres, y=X.ref)
require(ECG) N<- 1000 set.seed(12345) d1<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4)+rnorm(5/2*N, 0, 0.01) dat<- data.frame(x=1:length(d1), y=100*(d1-min(d1))/(max(d1)-min(d1))) CGres<- CGdata(dat) X.ref <- list(x=1250, u=0, dof=Inf) assess(CGres, y=X.ref)
Evaluates the CGr object estimation against a reference value by the En index.
## S3 method for class 'CGr' assess(x, y, x.B = list(u=0, dof=Inf), alpha=x$input$alpha)
## S3 method for class 'CGr' assess(x, y, x.B = list(u=0, dof=Inf), alpha=x$input$alpha)
x |
a Estimator object |
y |
a list with the reference value (x, u, dof) |
x.B |
a list with the estimate of uncertainty type B for the x object and its degrees of freedom |
alpha |
numeric, the level of significance used to compute the coverage factor and the expanded uncertainty |
the numeric value of the En index evaluation.
H. Gasca-Aragon
require(ECG) X.ref<- list(x=1250, u=0, dof=Inf) N<- 1000 d0<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4) set.seed(12345) d1<- d0+rnorm(5/2*N, 0, 0.01) d2<- d0+rnorm(5/2*N, 0, 0.01) dat<- data.frame(x=1:length(d1), y1=100*(d1-min(d1))/(max(d1)-min(d1)), y2=100*(d2-min(d2))/(max(d2)-min(d2))) CGres<- CGr(dat, columns=c(2,3)) assess(CGres, X.ref)
require(ECG) X.ref<- list(x=1250, u=0, dof=Inf) N<- 1000 d0<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4) set.seed(12345) d1<- d0+rnorm(5/2*N, 0, 0.01) d2<- d0+rnorm(5/2*N, 0, 0.01) dat<- data.frame(x=1:length(d1), y1=100*(d1-min(d1))/(max(d1)-min(d1)), y2=100*(d2-min(d2))/(max(d2)-min(d2))) CGres<- CGr(dat, columns=c(2,3)) assess(CGres, X.ref)
Evaluates the ECGdata object estimation against the reference value by the En index.
## S3 method for class 'ECGdata' assess(x, y, x.B = list(u=0, dof=Inf), alpha=x$input$alpha)
## S3 method for class 'ECGdata' assess(x, y, x.B = list(u=0, dof=Inf), alpha=x$input$alpha)
x |
a Estimator object |
y |
a list with the reference value (x, u, dof) |
x.B |
a list with the estimate of uncertainty type B for the x object and its degrees of freedom |
alpha |
numeric, the level of significance used to compute the coverage factor and the expanded uncertainty |
the numeric value of the En index evaluation.
H. Gasca-Aragon
require(ECG) N<- 1000 set.seed(12345) d1<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4)+rnorm(5/2*N, 0, 0.01) dat<- data.frame(x=1:length(d1), y=100*(d1-min(d1))/(max(d1)-min(d1))) ECGres<- ECGdata(dat) X.ref <- list(x=1250, u=0, dof=Inf) assess(ECGres, y=X.ref)
require(ECG) N<- 1000 set.seed(12345) d1<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4)+rnorm(5/2*N, 0, 0.01) dat<- data.frame(x=1:length(d1), y=100*(d1-min(d1))/(max(d1)-min(d1))) ECGres<- ECGdata(dat) X.ref <- list(x=1250, u=0, dof=Inf) assess(ECGres, y=X.ref)
Evaluates the ECGr object estimation against a reference value by the En index.
## S3 method for class 'ECGr' assess(x, y, x.B = list(u=0, dof=Inf), alpha=x$input$alpha)
## S3 method for class 'ECGr' assess(x, y, x.B = list(u=0, dof=Inf), alpha=x$input$alpha)
x |
a Estimator object |
y |
a list with the reference value (x, u, dof) |
x.B |
a list with the estimate of uncertainty type B for the x object and its degrees of freedom |
alpha |
numeric, the level of significance used to compute the coverage factor and the expanded uncertainty |
the numeric value of the En index evaluation. This is a normalized error value with expanded uncertainty equals 1.0.
H. Gasca-Aragon
require(ECG) X.ref<- list(x=pi/2, u=0, dof=Inf) N<- 1000 d0<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4) set.seed(12345) d1<- d0+rnorm(5/2*N, 0, 0.01) d2<- d0+rnorm(5/2*N, 0, 0.01) dat<- data.frame(x=1:length(d1), y1=100*(d1-min(d1))/(max(d1)-min(d1)), y2=100*(d2-min(d2))/(max(d2)-min(d2))) ECGres<- ECGr(dat, min(dat$x), max(dat$x), columns=c(2,3), responseLowerLimit=0, responseUpperLimit=100) assess(ECGres, X.ref)
require(ECG) X.ref<- list(x=pi/2, u=0, dof=Inf) N<- 1000 d0<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4) set.seed(12345) d1<- d0+rnorm(5/2*N, 0, 0.01) d2<- d0+rnorm(5/2*N, 0, 0.01) dat<- data.frame(x=1:length(d1), y1=100*(d1-min(d1))/(max(d1)-min(d1)), y2=100*(d2-min(d2))/(max(d2)-min(d2))) ECGres<- ECGr(dat, min(dat$x), max(dat$x), columns=c(2,3), responseLowerLimit=0, responseUpperLimit=100) assess(ECGres, X.ref)
Builds a CGdata (center of gravity) object for a series of single observations.
CGdata(data, from=min(data$x), to=max(data$x), responseFraction = 0.5, useConstantDelta = FALSE, fixedResponseFraction = 0.5, useFixedResponseFraction = FALSE, replaceOutliers = TRUE, responseLowerLimit = min(data$y), responseUpperLimit = max(data$y), alpha = 0.05, signifDigits = 2, ...)
CGdata(data, from=min(data$x), to=max(data$x), responseFraction = 0.5, useConstantDelta = FALSE, fixedResponseFraction = 0.5, useFixedResponseFraction = FALSE, replaceOutliers = TRUE, responseLowerLimit = min(data$y), responseUpperLimit = max(data$y), alpha = 0.05, signifDigits = 2, ...)
data |
a data frame structure containing (x, y) columns. |
from |
a numeric value with the initial value of |
to |
a numeric value with the final value of |
responseFraction |
a real value with the fraction (0,1) of the maximum height to be considered in the analysis. |
useConstantDelta |
a logic value, if true then it assumes the values of |
fixedResponseFraction |
a numeric with the fraction of height to be used as a reference to normilize, default value is 0.5. |
useFixedResponseFraction |
a logic value, if TRUE then it uses the value of |
replaceOutliers |
a logic value, if true then it uses the value of |
responseLowerLimit |
a real value to be used as the default to replace outlier values lower than expected. |
responseUpperLimit |
a real value to be used as the default to replace outlier values larger than expected. |
alpha |
a real value, it defines the level of error type I used to estimate the
coverage factor |
signifDigits |
an integer value, it defines the number of significant digits to be used for displaying the result and its uncertainty, default value is 2. |
... |
additional parameters. |
x |
numeric, the estimated value |
u |
numeric, the estimated uncertainty associated to x |
moments |
numeric vector, the estimated mean, variance, skweness and kurtosis |
input |
list, contains the input parameters |
frame |
list, contains the reference values of the analysis. This
information is used to build a verbosed version of its plot. The content of
the list is:
|
H. Gasca-Aragon
require(ECG) N<- 1000 set.seed(12345) d1<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4)+rnorm(5/2*N, 0, 0.01) dat<- data.frame(x=1:length(d1), y=100*(d1-min(d1))/(max(d1)-min(d1))) CGres <- CGdata(dat) CGres
require(ECG) N<- 1000 set.seed(12345) d1<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4)+rnorm(5/2*N, 0, 0.01) dat<- data.frame(x=1:length(d1), y=100*(d1-min(d1))/(max(d1)-min(d1))) CGres <- CGdata(dat) CGres
Builds a CGr (center of gravity) object for a series of replicated observations.
CGr(data, from=min(data$x), to=max(data$x), columns, responseFraction = 0.50, useConstantDelta=FALSE, fixedResponseFraction=0.5, useFixedResponseFraction=FALSE, replaceOutliers=TRUE, responseLowerLimit=min(data[, columns]), responseUpperLimit=max(data[, columns]), alpha=0.05, kp=if(length(columns)<=1) qnorm(1-alpha/2) else qt(1-alpha/2, length(columns)-1), signifDigits=2, useRobustStatistics = TRUE, ...)
CGr(data, from=min(data$x), to=max(data$x), columns, responseFraction = 0.50, useConstantDelta=FALSE, fixedResponseFraction=0.5, useFixedResponseFraction=FALSE, replaceOutliers=TRUE, responseLowerLimit=min(data[, columns]), responseUpperLimit=max(data[, columns]), alpha=0.05, kp=if(length(columns)<=1) qnorm(1-alpha/2) else qt(1-alpha/2, length(columns)-1), signifDigits=2, useRobustStatistics = TRUE, ...)
data |
a data frame structure containing (date, x, y1, ..., yn) columns, it may contain some other columns. |
from |
a numeric value with the initial value of x to search for a local minimum. |
to |
a numeric value with the final value of x to search for a local minimum. |
columns |
a vector of indexes of the columns to be considered in the profile. |
responseFraction |
numeric, fraction of the maximum height to be considered in the analysis, |
useConstantDelta |
boolean flag, if true constant increment in the x values is assumed, otherwise the difference is computed for each increment of x. |
fixedResponseFraction |
a numeric with the fraction of hieght to be used as a reference to normilize. |
useFixedResponseFraction |
a logical value, if true then it uses the value of f.fixed to normalize all the computations, otherwise it uses the values of extrapolation sequence of fractions to normalize. |
replaceOutliers |
a logic value, if true then it uses the value of |
responseLowerLimit |
a real value to be used as the default to replace outlier values lower than expected, its default value is 0. |
responseUpperLimit |
a real value to be used as the default to replace outlier values larger than expected, its default value is 1. |
alpha |
a real value, define the level of significance for building confidence interval. |
kp |
a real value, it defines the coverage factor to be used to estimate the
expanded uncertainty. It is build based on the level of significance
|
signifDigits |
number of significant digits used to display the result. |
useRobustStatistics |
a logical value, if true then median and mad are used to estimate location and dispersion otherwise the mean and standard deviation are used. |
... |
additional parameters. |
x |
numeric, the estimated value |
u |
numeric, the estimated uncertainty associated to x |
moments |
numeric vector, the estimated mean, variance, skweness and kurtosis |
input |
list, contains the current input parameters, including the default values
additional parameters passed through |
frame |
list, contains the reference values of the analysis. This
information is used to build a verbosed version of its plot. The content of
the list is:
|
H. Gasca-Aragon
require(ECG) N<- 1000 set.seed(12345) d1<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4)+rnorm(5/2*N, 0, 0.01) d2<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4)+rnorm(5/2*N, 0, 0.01) dat<- data.frame(x=1:length(d1), y1=100*(d1-min(d1))/(max(d1)-min(d1)), y2=100*(d2-min(d2))/(max(d2)-min(d2)) ) CGres<- CGr(dat, columns=c(2,3)) CGres
require(ECG) N<- 1000 set.seed(12345) d1<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4)+rnorm(5/2*N, 0, 0.01) d2<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4)+rnorm(5/2*N, 0, 0.01) dat<- data.frame(x=1:length(d1), y1=100*(d1-min(d1))/(max(d1)-min(d1)), y2=100*(d2-min(d2))/(max(d2)-min(d2)) ) CGres<- CGr(dat, columns=c(2,3)) CGres
Builds a ECGdata object to estimate an extrapolation of the local minimum in the response for a series of single observations.
ECGdata(data, from=min(data$x), to=max(data$x), useConstantDelta = FALSE, maxResponseFraction = 0.5, minResponseFraction = 0.05, byResponseFraction = -0.05, fixedResponseFraction = 0.5, useFixedResponseFraction = FALSE, replaceOutliers = TRUE, responseLowerLimit=min(data$y), responseUpperLimit=max(data$y), alpha = 0.05, kp = qnorm(1-alpha/2), signifDigits = 2, useRobustStatistics = TRUE, ...)
ECGdata(data, from=min(data$x), to=max(data$x), useConstantDelta = FALSE, maxResponseFraction = 0.5, minResponseFraction = 0.05, byResponseFraction = -0.05, fixedResponseFraction = 0.5, useFixedResponseFraction = FALSE, replaceOutliers = TRUE, responseLowerLimit=min(data$y), responseUpperLimit=max(data$y), alpha = 0.05, kp = qnorm(1-alpha/2), signifDigits = 2, useRobustStatistics = TRUE, ...)
data |
a data frame structure containing (x, y) columns. |
from |
a numeric value with the initial value of x to search for a local minimum. |
to |
a numeric value with the final value of x to search for a local minimum. |
useConstantDelta |
a logical value, if true then it uses the mean value of the differences in x, otherwise, it uses the differences in x to estimate the expected value. in the analysis. |
maxResponseFraction |
a real value with the fraction (0,1) of the maximum height to be considered in the analysis. |
minResponseFraction |
a real value with the fraction (0,1) of the minimum height to be considered in the analysis. |
byResponseFraction |
a real value with the fraction (0,1) of the decrement of height to be considered in the analysis. The extrapolation analysis uses the sequence: maxResponseFraction, maxResponseFraction+byResponseFraction, ..., minResponseFraction |
fixedResponseFraction |
a numeric with the fraction of hieght to be used as a reference to normilize. |
useFixedResponseFraction |
a logical value, if true then it uses the value of f.fixed to normalize all the computations, otherwise it uses the values of extrapolation sequence of fractions to normalize. |
replaceOutliers |
a logic value, if true then it uses the value of |
responseLowerLimit |
a real value to be used as the default to replace outlier values lower than expected, its default value is 0. |
responseUpperLimit |
a real value to be used as the default to replace outlier values larger than expected, its default value is 1. |
alpha |
a real value, define the level of significance for building confidence interval. |
kp |
a real value, it defines the coverage factor to be used to estimate the
expanded uncertainty. It is build based on the level of significance
|
signifDigits |
number of significant digits used to display the result. |
useRobustStatistics |
a logical value, if true then median and mad are used to estimate location and dispersion otherwise the mean and standard deviation are used. |
... |
additional parameters. |
The data at each step is a subset of the previous step hence the estimates are correlated. However by specifying useFixedResponseFraction=FALSE they are normalized against distinct fraction of the height.
x |
numeric, the estimated value |
u |
numeric, the estimated uncertainty associated to x |
input |
list, contains the input parameters |
frame |
list, contains the reference values of the analysis. This
information is used to build a verbosed version of its plot. The content of
the list is: |
H. Gasca-Aragon
See Also as CGdata
, print.ECGdata
, plot.ECGdata
require(ECG) N<- 1000 set.seed(12345) d1<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4)+rnorm(5/2*N, 0, 0.01) dat<- data.frame(x=1:length(d1), y=100*(d1-min(d1))/(max(d1)-min(d1))) ECGdata(dat) ECGdata
require(ECG) N<- 1000 set.seed(12345) d1<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4)+rnorm(5/2*N, 0, 0.01) dat<- data.frame(x=1:length(d1), y=100*(d1-min(d1))/(max(d1)-min(d1))) ECGdata(dat) ECGdata
Builds an ECGr object to estimate an extrapolation of the local minimum in the response for a series of replicated observations.
ECGr(data, from=min(data$x), to=max(data$x), columns, useConstantDelta=FALSE, maxResponseFraction=0.5, minResponseFraction=0.05, byResponseFraction=-0.05, fixedResponseFraction=0.5, useFixedResponseFraction = FALSE, replaceOutliers = TRUE, responseLowerLimit = min(data[, columns]), responseUpperLimit = max(data[, columns]), alpha=0.05, kp=if(length(columns)<=1) qnorm(1-alpha/2) else qt(1-alpha/2, length(columns)-1), signifDigits = 2, useRobustStatistics=TRUE, ...)
ECGr(data, from=min(data$x), to=max(data$x), columns, useConstantDelta=FALSE, maxResponseFraction=0.5, minResponseFraction=0.05, byResponseFraction=-0.05, fixedResponseFraction=0.5, useFixedResponseFraction = FALSE, replaceOutliers = TRUE, responseLowerLimit = min(data[, columns]), responseUpperLimit = max(data[, columns]), alpha=0.05, kp=if(length(columns)<=1) qnorm(1-alpha/2) else qt(1-alpha/2, length(columns)-1), signifDigits = 2, useRobustStatistics=TRUE, ...)
data |
a data frame structure containing (date, x, y1, ..., yn) columns, it may contain some other columns. |
from |
a numeric value with the initial value of x to search for a local minimum. |
to |
a numeric value with the final value of x to search for a local minimum. |
columns |
a vector of indexes of the columns to be considered in the profile. |
useConstantDelta |
a logical value, if true then it uses the mean value of the differences in x, otherwise, it uses the differences in x to estimate the expected value. in the analysis. |
maxResponseFraction |
a real value with the fraction (0,1) of the maximum height to be considered in the analysis. |
minResponseFraction |
a real value with the fraction (0,1) of the minimum height to be considered in the analysis. |
byResponseFraction |
a real value with the fraction (0,1) of the decrement of height to be considered in the analysis. The extrapolation analysis uses the sequence: maxResponseFraction, maxResponseFraction+byResponseFraction, ..., minResponseFraction |
fixedResponseFraction |
a numeric with the fraction of hieght to be used as a reference to normilize. |
useFixedResponseFraction |
a logical value, if true then it uses the value of f.fixed to normalize all the computations, otherwise it uses the values of extrapolation sequence of fractions to normalize. |
replaceOutliers |
a logic value, if true then it uses the value of |
responseLowerLimit |
a real value to be used as the default to replace outlier values lower than expected, its default value is 0. |
responseUpperLimit |
a real value to be used as the default to replace outlier values larger than expected, its default value is 1. |
alpha |
a real value, define the level of significance for building confidence interval. |
kp |
a real value, it defines the coverage factor to be used to estimate the
expanded uncertainty. It is build based on the level of significance
|
signifDigits |
number of significant digits used to display the result. |
useRobustStatistics |
a logical value, if true then median and mad are used to estimate location and dispersion otherwise the mean and standard deviation are used. |
... |
additional parameters. |
x |
numeric, the estimated value |
u |
numeric, the estimated uncertainty associated to x |
input |
list, contains the input parameters |
frame |
list, contains the reference values of the analysis. This
information is used to build a verbosed version of its plot. The content of
the list is:
|
H. Gasca-Aragon
See Also as ECGdata
, print.ECGr
, plot.ECGr
require(ECG) N<- 1000 set.seed(12345) d1<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4)+rnorm(5/2*N, 0, 0.01) d2<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4)+rnorm(5/2*N, 0, 0.01) dat<- data.frame(x=1:length(d1), y1=100*(d1-min(d1))/(max(d1)-min(d1)), y2=100*(d2-min(d2))/(max(d2)-min(d2)) ) ECGres<- ECGr(dat, columns=c(2,3)) ECGres
require(ECG) N<- 1000 set.seed(12345) d1<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4)+rnorm(5/2*N, 0, 0.01) d2<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4)+rnorm(5/2*N, 0, 0.01) dat<- data.frame(x=1:length(d1), y1=100*(d1-min(d1))/(max(d1)-min(d1)), y2=100*(d2-min(d2))/(max(d2)-min(d2)) ) ECGres<- ECGr(dat, columns=c(2,3)) ECGres
Creates a plot of a series of single observations.
## S3 method for class 'CGdata' plot(x, from=x$input$from, to=x$input$to, xlab = expression(nu(cm^-1)), ylab = "Transmittance", add = FALSE, verbose = FALSE, ...)
## S3 method for class 'CGdata' plot(x, from=x$input$from, to=x$input$to, xlab = expression(nu(cm^-1)), ylab = "Transmittance", add = FALSE, verbose = FALSE, ...)
x |
a CGdata object |
from |
lower limit point on the predictor value to be plotted |
to |
upper limit point on the predictor value to be plotted |
xlab |
a string or expression with the label for the x axis |
ylab |
a string or expression with the label for the y axis |
add |
a logical value, if true then the plot is added to an existing one, otherwise it creates a new plot |
verbose |
a logical value, if true then the plot displays intermediate steps to estimate the extreme point located between the from and to values |
... |
additional parameters |
No return value, called for graphical display side effects
H. Gasca-Aragon
See Also as CGdata
, print.CGdata
require(ECG) N<- 1000 set.seed(12345) d1<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4)+rnorm(5/2*N, 0, 0.01) dat<- data.frame(x=1:length(d1), y=100*(d1-min(d1))/(max(d1)-min(d1))) CGres<- CGdata(dat) plot(CGres, min(dat$x), max(dat$x), verbose = TRUE)
require(ECG) N<- 1000 set.seed(12345) d1<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4)+rnorm(5/2*N, 0, 0.01) dat<- data.frame(x=1:length(d1), y=100*(d1-min(d1))/(max(d1)-min(d1))) CGres<- CGdata(dat) plot(CGres, min(dat$x), max(dat$x), verbose = TRUE)
Creates a plot of a series of replicated data. It shows the summary of the series. Optionally it shows the limits of the range of analysis and the estimated local minimum computed as the center of gravity.
## S3 method for class 'CGr' plot(x, ...)
## S3 method for class 'CGr' plot(x, ...)
x |
a CGr object |
... |
additional parameters |
No return value, called for graphical display.
H. Gasca-Aragon
require(ECG) N<- 1000 set.seed(12345) d1<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4)+rnorm(5/2*N, 0, 0.01) d2<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4)+rnorm(5/2*N, 0, 0.01) dat<- data.frame(x=1:length(d1), y1=100*(d1-min(d1))/(max(d1)-min(d1)), y2=100*(d2-min(d2))/(max(d2)-min(d2)) ) CGres<- CGr(dat, columns=c(2,3)) plot(CGres)
require(ECG) N<- 1000 set.seed(12345) d1<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4)+rnorm(5/2*N, 0, 0.01) d2<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4)+rnorm(5/2*N, 0, 0.01) dat<- data.frame(x=1:length(d1), y1=100*(d1-min(d1))/(max(d1)-min(d1)), y2=100*(d2-min(d2))/(max(d2)-min(d2)) ) CGres<- CGr(dat, columns=c(2,3)) plot(CGres)
Creates a plot for a series of single observations with the extrapolated center of gravity method.
## S3 method for class 'ECGdata' plot(x, xlim=range(x$frame$solution[,1]), ylim=c(0, max(x$frame$solution[,5])), xlab=expression(nu[i]), ylab=expression(f[i]), add=TRUE, ...)
## S3 method for class 'ECGdata' plot(x, xlim=range(x$frame$solution[,1]), ylim=c(0, max(x$frame$solution[,5])), xlab=expression(nu[i]), ylab=expression(f[i]), add=TRUE, ...)
x |
an ECGdata object |
xlim |
a range with the x limits for plotting purposes |
ylim |
a range with the y limits for plotting purposes |
xlab |
a string or expression with the label for the x axis |
ylab |
a string or expression with the label for the y axis |
add |
a logical value, if true then the plot is added to an existing one, otherwise it creates a new plot. |
... |
additional parameters |
It plots the sequence of approximations for each fraction of the dataset, and it shows the estimated value while extrapolated at zero fraction. Use it in collaboration with CGdata::plot to show the data, the search frame, and the sequence of approximations.
No return value.
H. Gasca-Aragon
See Also as ECGdata
, print.ECGdata
, plot.ECGdata
require(ECG) N<- 1000 set.seed(12345) d1<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4)+rnorm(5/2*N, 0, 0.01) dat<- data.frame(x=1:length(d1), y=100*(d1-min(d1))/(max(d1)-min(d1))) CGres <- CGdata(dat) ECGres<- ECGdata(dat) # use it alone, plot the sequence of approximations plot(ECGres, add = FALSE) # use it in collaboration with CGdata # display the Center of Gravity approach for single observation plot(CGres, min(dat$x), max(dat$x)) # then add the extrapolation sequence plot(ECGres)
require(ECG) N<- 1000 set.seed(12345) d1<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4)+rnorm(5/2*N, 0, 0.01) dat<- data.frame(x=1:length(d1), y=100*(d1-min(d1))/(max(d1)-min(d1))) CGres <- CGdata(dat) ECGres<- ECGdata(dat) # use it alone, plot the sequence of approximations plot(ECGres, add = FALSE) # use it in collaboration with CGdata # display the Center of Gravity approach for single observation plot(CGres, min(dat$x), max(dat$x)) # then add the extrapolation sequence plot(ECGres)
Creates a plot for a series of replicated observations with the extrapolated center of gravity method.
## S3 method for class 'ECGr' plot(x, add = TRUE, ...)
## S3 method for class 'ECGr' plot(x, add = TRUE, ...)
x |
an ECGr object. |
add |
a logical value, if true then the plot is added to an existing one, otherwise it creates a new plot. |
... |
additional parameters. |
It plots the sequence of approximations for each fraction of the dataset, and it shows the estimated value while extrapolated at zero fraction.
No return value. Used for graphical display.
H. Gasca-Aragon
See Also as ECGr
, print.ECGr
require(ECG) N<- 1000 set.seed(12345) d1<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4)+rnorm(5/2*N, 0, 0.01) d2<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4)+rnorm(5/2*N, 0, 0.01) dat<- data.frame(x=1:length(d1), y1=100*(d1-min(d1))/(max(d1)-min(d1)), y2=100*(d2-min(d2))/(max(d2)-min(d2)) ) # used alone ECGres<- ECGr(dat, columns=c(2,3)) plot(ECGres, add = FALSE) # used in colaboration with CGr CGres<- CGr(dat, columns=c(2,3)) # display the Center of Gravity approach for replicated observations plot(CGres, verbose = TRUE) # then add the extrapolation sequence plot(ECGres)
require(ECG) N<- 1000 set.seed(12345) d1<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4)+rnorm(5/2*N, 0, 0.01) d2<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4)+rnorm(5/2*N, 0, 0.01) dat<- data.frame(x=1:length(d1), y1=100*(d1-min(d1))/(max(d1)-min(d1)), y2=100*(d2-min(d2))/(max(d2)-min(d2)) ) # used alone ECGres<- ECGr(dat, columns=c(2,3)) plot(ECGres, add = FALSE) # used in colaboration with CGr CGres<- CGr(dat, columns=c(2,3)) # display the Center of Gravity approach for replicated observations plot(CGres, verbose = TRUE) # then add the extrapolation sequence plot(ECGres)
Displays the content of a CGdata object.
## S3 method for class 'CGdata' print(x, signifDigits=x$input$signifDigits, alpha=x$input$alpha, verbose=FALSE, ...)
## S3 method for class 'CGdata' print(x, signifDigits=x$input$signifDigits, alpha=x$input$alpha, verbose=FALSE, ...)
x |
a CGdata object. |
signifDigits |
a numeric value for the number of significant digits. |
alpha |
a probability value taken as the significance level for building a
symmetric confidence interval assuming a t distribution for |
verbose |
a boolean, if FALSE the description of the form |
... |
additional parameters |
No return value, called for displaying purposes/side effect.
H. Gasca-Aragon
objects to See Also as CGdata
,
require(ECG) N<- 1000 set.seed(12345) d1<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4)+rnorm(5/2*N, 0, 0.01) dat<- data.frame(x=1:length(d1), y=100*(d1-min(d1))/(max(d1)-min(d1))) CGres<- CGdata(dat) CGres print(CGres)
require(ECG) N<- 1000 set.seed(12345) d1<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4)+rnorm(5/2*N, 0, 0.01) dat<- data.frame(x=1:length(d1), y=100*(d1-min(d1))/(max(d1)-min(d1))) CGres<- CGdata(dat) CGres print(CGres)
Displays the content of a CGr object.
## S3 method for class 'CGr' print(x, signifDigits=x$input$signifDigits, alpha = x$input$alpha, verbose=FALSE, ...)
## S3 method for class 'CGr' print(x, signifDigits=x$input$signifDigits, alpha = x$input$alpha, verbose=FALSE, ...)
x |
a CGr object. |
signifDigits |
a numeric value for the number of significant digits. |
alpha |
a probability value taken as the significance level for building a
symmetric confidence interval assuming a t distribution for |
verbose |
a boolean, if FALSE the description of the form |
... |
additional parameters |
No return value.
H. Gasca-Aragon
require(ECG) N<- 1000 set.seed(12345) d1<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4)+rnorm(5/2*N, 0, 0.01) d2<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4)+rnorm(5/2*N, 0, 0.01) dat<- data.frame(x=1:length(d1), y1=100*(d1-min(d1))/(max(d1)-min(d1)), y2=100*(d2-min(d2))/(max(d2)-min(d2)) ) CGres<- CGr(dat, columns=c(2,3)) print(CGres)
require(ECG) N<- 1000 set.seed(12345) d1<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4)+rnorm(5/2*N, 0, 0.01) d2<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4)+rnorm(5/2*N, 0, 0.01) dat<- data.frame(x=1:length(d1), y1=100*(d1-min(d1))/(max(d1)-min(d1)), y2=100*(d2-min(d2))/(max(d2)-min(d2)) ) CGres<- CGr(dat, columns=c(2,3)) print(CGres)
Displays the content of a ECGdata object.
## S3 method for class 'ECGdata' print(x, signifDigits=x$input$signifDigits, alpha = x$input$alpha, verbose=FALSE, ...)
## S3 method for class 'ECGdata' print(x, signifDigits=x$input$signifDigits, alpha = x$input$alpha, verbose=FALSE, ...)
x |
an ECGdata object. |
signifDigits |
a numeric value for the number of significant digits. |
alpha |
a probability value taken as the significance level for building a
symmetric confidence interval assuming a t distribution for |
verbose |
a boolean, if FALSE the description of the form |
... |
additional parameters |
No return value. Used for textual displaying side effect.
H. Gasca-Aragon
require(ECG) N<- 1000 set.seed(12345) d1<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4)+rnorm(5/2*N, 0, 0.01) dat<- data.frame(x=1:length(d1), y=100*(d1-min(d1))/(max(d1)-min(d1))) ECGres<- ECGdata(dat) ECGres print(ECGres)
require(ECG) N<- 1000 set.seed(12345) d1<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4)+rnorm(5/2*N, 0, 0.01) dat<- data.frame(x=1:length(d1), y=100*(d1-min(d1))/(max(d1)-min(d1))) ECGres<- ECGdata(dat) ECGres print(ECGres)
Displays the content of a ECGr object.
## S3 method for class 'ECGr' print(x, signifDigits=x$input$signifDigits, alpha = x$input$alpha, verbose=FALSE, ...)
## S3 method for class 'ECGr' print(x, signifDigits=x$input$signifDigits, alpha = x$input$alpha, verbose=FALSE, ...)
x |
an ECGr object. |
signifDigits |
a numeric value for the number of significant digits. |
alpha |
a probability value taken as the significance level for building a
symmetric confidence interval assuming a t distribution for |
verbose |
a boolean, if FALSE the description of the form |
... |
additional parameters |
No return value. Used for textual display purposes.
H. Gasca-Aragon
require(ECG) N<- 1000 set.seed(12345) d1<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4)+rnorm(5/2*N, 0, 0.01) d2<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4)+rnorm(5/2*N, 0, 0.01) dat<- data.frame(x=1:length(d1), y1=100*(d1-min(d1))/(max(d1)-min(d1)), y2=100*(d2-min(d2))/(max(d2)-min(d2)) ) ECGres<- ECGr(dat, columns=c(2,3)) ECGres print(ECGres) CGres<- CGr(dat, columns=c(2,3)) CGres print(CGres)
require(ECG) N<- 1000 set.seed(12345) d1<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4)+rnorm(5/2*N, 0, 0.01) d2<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4)+rnorm(5/2*N, 0, 0.01) dat<- data.frame(x=1:length(d1), y1=100*(d1-min(d1))/(max(d1)-min(d1)), y2=100*(d2-min(d2))/(max(d2)-min(d2)) ) ECGres<- ECGr(dat, columns=c(2,3)) ECGres print(ECGres) CGres<- CGr(dat, columns=c(2,3)) CGres print(CGres)
Converts a CGdata object into a string description for displaying purposes.
## S3 method for class 'CGdata' toString(x, signifDigits=x$input$signifDigits, alpha=x$input$alpha, verbose=FALSE, ...)
## S3 method for class 'CGdata' toString(x, signifDigits=x$input$signifDigits, alpha=x$input$alpha, verbose=FALSE, ...)
x |
a CGdata object |
signifDigits |
a numeric value for the number of significant digits. |
alpha |
a probability value taken as the significance level for building a
symmetric confidence interval assuming a t distribution for |
verbose |
a boolean, if FALSE the description of the form |
... |
additional parameters |
a string description of the CGdata object.
H. Gasca-Aragon
require(ECG) N<- 1000 d0<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4) set.seed(12345) d1<- d0+rnorm(5/2*N, 0, 0.01) dat<- data.frame(x=1:length(d1), y=100*(d1-min(d1))/(max(d1)-min(d1))) CGres<- CGdata(dat) str.res <- toString(CGres) print(nchar(str.res)) print(str.res)
require(ECG) N<- 1000 d0<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4) set.seed(12345) d1<- d0+rnorm(5/2*N, 0, 0.01) dat<- data.frame(x=1:length(d1), y=100*(d1-min(d1))/(max(d1)-min(d1))) CGres<- CGdata(dat) str.res <- toString(CGres) print(nchar(str.res)) print(str.res)
Converts a CGr object into a string description for displaying purposes.
## S3 method for class 'CGr' toString(x, signifDigits=x$input$signifDigits, alpha=x$input$alpha, verbose=FALSE, ...)
## S3 method for class 'CGr' toString(x, signifDigits=x$input$signifDigits, alpha=x$input$alpha, verbose=FALSE, ...)
x |
a CGr object |
signifDigits |
a numeric value for the number of significant digits. |
alpha |
a probability value taken as the significance level for building a
symmetric confidence interval assuming a t distribution for |
verbose |
a boolean, if FALSE the description of the form |
... |
additional parameters |
a string description of the CGr object.
H. Gasca-Aragon
require(ECG) X.ref<- list(x=pi/2, u=0) N<- 1000 d0<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4) set.seed(12345) d1<- d0+rnorm(5/2*N, 0, 0.01) d2<- d0+rnorm(5/2*N, 0, 0.01) dat<- data.frame(x=1:length(d1), y1=100*(d1-min(d1))/(max(d1)-min(d1)), y2=100*(d2-min(d2))/(max(d2)-min(d2))) CGres<- CGr(dat, columns=c(2,3)) str.res <- toString(CGres) print(nchar(str.res))
require(ECG) X.ref<- list(x=pi/2, u=0) N<- 1000 d0<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4) set.seed(12345) d1<- d0+rnorm(5/2*N, 0, 0.01) d2<- d0+rnorm(5/2*N, 0, 0.01) dat<- data.frame(x=1:length(d1), y1=100*(d1-min(d1))/(max(d1)-min(d1)), y2=100*(d2-min(d2))/(max(d2)-min(d2))) CGres<- CGr(dat, columns=c(2,3)) str.res <- toString(CGres) print(nchar(str.res))
Converts a ECGdata object into a string description for displaying purposes.
## S3 method for class 'ECGdata' toString(x, signifDigits=x$input$signifDigits, alpha=x$input$alpha, verbose=FALSE, ...)
## S3 method for class 'ECGdata' toString(x, signifDigits=x$input$signifDigits, alpha=x$input$alpha, verbose=FALSE, ...)
x |
an ECGdata object |
signifDigits |
a numeric value for the number of significant digits. |
alpha |
a probability value taken as the significance level for building a
symmetric confidence interval assuming a t distribution for |
verbose |
a boolean, if FALSE the description of the form |
... |
additional parameters |
a string description of the ECGdata object.
H. Gasca-Aragon
require(ECG) X.ref<- list(x=pi/2, u=0) N<- 1000 d0<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4) set.seed(12345) d1<- d0+rnorm(5/2*N, 0, 0.01) dat<- data.frame(x=1:length(d1), y=100*(d1-min(d1))/(max(d1)-min(d1))) ECGres<- ECGdata(dat) str.res <- toString(ECGres) print(str.res)
require(ECG) X.ref<- list(x=pi/2, u=0) N<- 1000 d0<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4) set.seed(12345) d1<- d0+rnorm(5/2*N, 0, 0.01) dat<- data.frame(x=1:length(d1), y=100*(d1-min(d1))/(max(d1)-min(d1))) ECGres<- ECGdata(dat) str.res <- toString(ECGres) print(str.res)
Converts an ECGr object into a string description for displaying purposes.
## S3 method for class 'ECGr' toString(x, signifDigits=x$input$signifDigits, alpha=x$input$alpha, verbose=FALSE, ...)
## S3 method for class 'ECGr' toString(x, signifDigits=x$input$signifDigits, alpha=x$input$alpha, verbose=FALSE, ...)
x |
a ECGr object |
signifDigits |
a numeric value for the number of significant digits. |
alpha |
a probability value taken as the significance level for building a
symmetric confidence interval assuming a t distribution for |
verbose |
a boolean, if FALSE the description of the form |
... |
addtional parameters |
a string description of the ECGr object.
H. Gasca-Aragon
require(ECG) X.ref<- list(x=pi/2, u=0) N<- 1000 d0<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4) set.seed(12345) d1<- d0+rnorm(5/2*N, 0, 0.01) d2<- d0+rnorm(5/2*N, 0, 0.01) dat<- data.frame(x=1:length(d1), y1=100*(d1-min(d1))/(max(d1)-min(d1)), y2=100*(d2-min(d2))/(max(d2)-min(d2))) ECGres<- ECGr(dat, columns=c(2,3)) str.res <- toString(ECGres) print(nchar(str.res))
require(ECG) X.ref<- list(x=pi/2, u=0) N<- 1000 d0<- 1-sin(seq(1:(5/2*N))/N*pi-pi*3/4) set.seed(12345) d1<- d0+rnorm(5/2*N, 0, 0.01) d2<- d0+rnorm(5/2*N, 0, 0.01) dat<- data.frame(x=1:length(d1), y1=100*(d1-min(d1))/(max(d1)-min(d1)), y2=100*(d2-min(d2))/(max(d2)-min(d2))) ECGres<- ECGr(dat, columns=c(2,3)) str.res <- toString(ECGres) print(nchar(str.res))