Skip to contents

Uses the parameters calculated by BC_param to model a DGB distribution (Mansilla et al. (2007) doi:10.1016/j.joi.2007.01.001 ) from the rank information in the data frame.

Usage

BC_model(df_abundance = NULL, column = NULL, BC_param_object = NULL, ...)

Arguments

df_abundance

A data frame that contains abundance data.

column

Either a string with the name of the column or the number of the column that stores the abundances in the data frame.

BC_param_object

Optional. A previous object generated by BC_param.

...

passes arguments to BC_param.

Value

A list with the following elements: The input data frame with added processed ranking data, model data and confidence interval data, the adjusted parameters, the confidence interval of the parameters, the linear model, a summary of the model and a generated function for use with raw numeric data.

Examples

modelISISCatalogued <- BC_model(Citation_ISICatalogued, column = 2, show_stats = F,rank_threshold=1)
head(modelISISCatalogued[[1]])
#>   pre_numerator pre_denominator        lwr predicted_values        upr BC_rank
#> 1           486               1 2797814.44       3399435.46 4130424.55       1
#> 2           485               2  617787.55        729817.29  862162.55       2
#> 3           484               3  255231.03        296644.61  344777.93       3
#> 4           483               4  136277.94        156587.12  179922.93       4
#> 5           482               5   83745.06         95381.80  108635.52       5
#> 6           481               6   56247.55         63607.92   71931.45       6
#>   N abundance
#> 1 0    368110
#> 2 1     70836
#> 3 2     44127
#> 4 3     32625
#> 5 4     25910
#> 6 5     21627
modelISISCatalogued[[6]](45)
#>        A 
#> 709.7155 
modelISISCatalogued[2:6]
#> [[1]]
#>            A            a            b 
#> 5.482970e+05 2.218812e+00 2.949379e-01 
#> 
#> [[2]]
#>                    2.5 %       97.5 %
#> (Intercept) 3.682324e+05 8.164128e+05
#> log_den     2.260682e+00 2.176941e+00
#> log_num     2.530679e-01 3.368079e-01
#> 
#> [[3]]
#> 
#> Call:
#> stats::lm(formula = log_abundance ~ log_den + log_num)
#> 
#> Coefficients:
#> (Intercept)      log_den      log_num  
#>     13.2146      -2.2188       0.2949  
#> 
#> 
#> [[4]]
#> 
#> Call:
#> stats::lm(formula = log_abundance ~ log_den + log_num)
#> 
#> Residuals:
#>      Min       1Q   Median       3Q      Max 
#> -2.33243 -0.18667 -0.06665  0.27185  1.20461 
#> 
#> Coefficients:
#>             Estimate Std. Error t value Pr(>|t|)    
#> (Intercept) 13.21457    0.20261   65.22   <2e-16 ***
#> log_den     -2.21881    0.02131 -104.12   <2e-16 ***
#> log_num      0.29494    0.02131   13.84   <2e-16 ***
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> 
#> Residual standard error: 0.3417 on 483 degrees of freedom
#> Multiple R-squared:  0.9796,	Adjusted R-squared:  0.9796 
#> F-statistic: 1.162e+04 on 2 and 483 DF,  p-value: < 2.2e-16
#> 
#> 
#> [[5]]
#> function (rank) 
#> {
#>     params["A"] * (max(t_frame[, "BC_rank"]) + 1 - rank)^params["b"]/(rank^params["a"])
#> }
#> <bytecode: 0x55894afcfc20>
#> <environment: 0x558950fde2a0>
#>