Learn R Programming

poweRlaw (version 0.80.0)

conlnorm-class: Heavy-tailed distributions

Description

The poweRlaw package supports a number of distributions:

displ

Discrete power-law

dislnorm

Discrete log-normal

dispois

Discrete Poisson

disexp

Discrete Exponential

conpl

Continuous power-law

conlnorm

Continuous log-normal

conexp

Continuous exponential

Each object inherits the discrete_distribution or the ctn_distribution class.

Value

a reference object

Arguments

...

The object is typically created by passing data using the dat field. Each field has standard setters and getters.

Fields

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

dat

The data set.

xmin

The lower threshold, xmin. Typically set after initialisation. For the continuous power-law, xmin >= 0 for the discrete distributions, xmin >0

pars

A parameter vector. Typically set after initialisation. Note the lognormal distribution has two parameters.

internal

A list. This list differs between objects and shouldn't be altered.

Copying objects

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.

Examples

Run this code
##############################################################
#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()

Run the code above in your browser using DataLab