Title: | Fits and Plots a Dataset to the Weibull Probability Distribution Function |
---|---|
Description: | Provides a single function to fit data of an input data frame into one of the selected Weibull functions (w2, w3 and it's truncated versions), calculating the scale, location and shape parameters accordingly. The resulting plots and files are saved into the 'folder' parameter provided by the user. References: a) John C. Nash, Ravi Varadhan (2011). "Unifying Optimization Algorithms to Aid Software System Users: optimx for R" <doi:10.18637/jss.v043.i09>. |
Authors: | Clayton Filho [aut], Thiago Martins [aut, cre] |
Maintainer: | Thiago Martins <[email protected]> |
License: | GPL-3 |
Version: | 0.1.0 |
Built: | 2025-03-05 03:31:46 UTC |
Source: | https://github.com/thiagomini/weibullfit |
Bus velocity at given Time
data(busTrace)
data(busTrace)
A data frame with columns:
Bus' series name
Bus' line name
Bus' velocity at given time
Time of record, in seconds
/hrefhttps://crawdad.org/coppe-ufrj/RioBuses/20180319/
Diameter at breast height of brazilian eucalyptus
data(TreesDBH)
data(TreesDBH)
A data frame with columns:
The Parcel's number (A primary group). Each parcel contais many trees at the same age
Trees' age at given parcel, in months
Trees' rounded age at given parcel, in months
Diameter at breast height, or DBH. It is the standard for measuring trees. DBH refers to the tree diameter measured at 4.5 feet above the ground.
still unknown
This functions calculates the shape, scale and location parameters for the weibull distribution to the input data and save the plots.
weibullFit(dataFrame, primaryGroup = "parcela", secondaryGroup = "idadearred", restrValue, pValue = "dap", leftTrunc = 5, folder = NA, limit = 1e+05, selectedFunctions = NULL, amp = 2, pmaxIT = 20, verbose = FALSE)
weibullFit(dataFrame, primaryGroup = "parcela", secondaryGroup = "idadearred", restrValue, pValue = "dap", leftTrunc = 5, folder = NA, limit = 1e+05, selectedFunctions = NULL, amp = 2, pmaxIT = 20, verbose = FALSE)
dataFrame |
the input data frame containing the independent, continuous variable. |
primaryGroup |
the name(String) of the primary grouping column of the data frame. |
secondaryGroup |
the name(String) of the secondary grouping column of the data frame. |
restrValue |
the restriction value choosen to be applied to the secondary group column. |
pValue |
the name(String) of the independent, continuos variable to be analyzed. |
leftTrunc |
An integer, defining the value for the weibull's function truncation. |
folder |
the pathname of the folder where the plots will be saved. |
limit |
A positive integer determining the maximum number of rows from the data frame (grouped by the primary group column) to be analyzed. |
selectedFunctions |
A character vector determining which weibull function to be applied. Can be any of the following: w2, w2te, w2td, w2tetd, w3, w3te, w3td, w3tetd |
amp |
The continuous variable class width to be accounted for the calculations. |
pmaxIT |
A positive integer, the maximum number of iterations used by the algorithm to try to get the weibull function parameters, for each primary group. |
verbose |
Logical, determines if the function prints more detailed results on the console. |
This function first extracts a subset of the input data frame using the restrValue parameter applied to the secondary group column. Then, it calculates the weibull function scale, shape and location parameters using the maximum-likelyhood method. Finally, it plots the results (as .wmf, .csv and .jpeg) inside the folder given by the Folder parameter.
A data frame object containing the best results for shape, location and scale parameters.
functions <- c("w2", "w3") best <- weibullFit(restrValue = 60, dataFrame = TreesDBH, selectedFunctions = functions, amp = 2, pmaxIT = 1, limit = 1)
functions <- c("w2", "w3") best <- weibullFit(restrValue = 60, dataFrame = TreesDBH, selectedFunctions = functions, amp = 2, pmaxIT = 1, limit = 1)