conlnorm-class | R Documentation |
The poweRlaw package supports a number of distributions:
Discrete power-law
Discrete log-normal
Discrete Poisson
Discrete Exponential
Continuous power-law
Continuous log-normal
Continuous exponential
Each object inherits the discrete_distribution
or the ctn_distribution
class.
... |
The object is typically created by passing
data using the |
a reference object
Each distribution object has four fields. However, the object
is typically created by passing
data, to the dat
field. Each field has standard
setters and getters. See examples below
The data set.
The lower threshold, xmin. Typically set after initialisation. For the continuous power-law, xmin >= 0 for the discrete distributions, xmin >0
A parameter vector. Typically set after initialisation. Note the lognormal distribution has two parameters.
A list. This list differs between objects and shouldn't be altered.
Distribution objects are reference classes. This means that when we copy
objects, we need to use the copy
method, i.e. obj$copy()
.
See the examples below for further details.
##############################################################
#Load data and create distribution object #
##############################################################
data(moby)
m = displ$new(moby)
##############################################################
#Xmin is initially the smallest x value #
##############################################################
m$getXmin()
m$getPars()
##############################################################
#Set Xmin and parameter #
##############################################################
m$setXmin(2)
m$setPars(2)
##############################################################
#Plot the data and fitted distribution #
##############################################################
plot(m)
lines(m)
##############################################################
#Copying #
##############################################################
## Shallow copy
m_cpy = m
m_cpy$setXmin(5)
m$getXmin()
## Instead
m_cpy = m$copy()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.