Package 'Fgmutils'

Title: Forest Growth Model Utilities
Description: Growth models and forest production require existing data manipulation and the creation of new data, structured from basic forest inventory data. The purpose of this package is provide functions to support these activities.
Authors: Clayton Vieira Fraga Filho, Ana Paula Simiqueli, Gilson Fernandes da Silva, Miqueias Fernandes, Wagner Amorim da Silva Altoe
Maintainer: Clayton Vieira Fraga Filho <[email protected]>
License: GPL-2
Version: 0.9.5
Built: 2024-12-09 06:51:36 UTC
Source: CRAN

Help Index


add column

Description

take a data-frame and a vector and combine by columns, respectively.

Usage

add.col(dataf, vec, namevec)

Arguments

dataf

dataframe

vec

vector

namevec

the names of the columns of vector

Value

dataf dataframe combined with the vector


updated base field

Description

this function update certain fields in a dataframe, based on the provided key

Usage

atualizaCampoBase(camposAtualizar, baseAgrupada, baseAtualizar, keys,
  verbose = FALSE)

Arguments

camposAtualizar

is the vector you want to update

baseAgrupada

It is the database that contains the data you want to update on dataframe

baseAtualizar

It is dataframe that you want to change fields

keys

are the keys of the table that will be used in the compare

verbose

default false

Value

baseAtualizar with the updated fields according to baseAgrupada


avalia Ajuste

Description

this function evaluates the quality of the adjustment of the statistical model, rom observed data and those estimated by the model, observed

Usage

avaliaAjuste(dataFrame, variavelObservados, variavelEstimados,
  linear = TRUE, nParametros = NA, intercepto = TRUE, plot = NA,
  modelo = NA, resumo = FALSE, emf = TRUE)

Arguments

dataFrame

dataFrane with information observed, estimated

variavelObservados

vector of values observed.

variavelEstimados

vector of values estimated.

linear

boolean is linear model

nParametros

number of parameters used in the adjusted model

intercepto

if you model is no-intercepto use FALSE

plot

Vector graphic information

modelo

the name of the adjusted model

resumo

if you want summary information, use TRUE

emf

to save the graphic in the format emf use TRUE


calculate Estimates

Description

given a list of observations and an estimated list of these observations this function evaluates how close it is the estimated value of observed and saves the differences

Usage

avaliaEstimativas(observado, estimado, estatisticas, ajuste = NULL,
  graficos = NULL, salvarEm = NULL, nome = "observadoXestimado")

Arguments

observado

list containing the observations of variable

estimado

list containing estimates of variable

estatisticas

list of arg to calc estatistics

ajuste

is ajust obtained a function like lm or nlsLM

graficos

list of arg to plot graphics

salvarEm

directory to save files

nome

name of files will be save

Value

will be returned


avalia Volume Age Based

Description

this function evaluate volume based on ages

Usage

avaliaVolumeAgeBased(base, firstAge, lastAge, models, mapper = list(age1
  = "idade1", age2 = "idade2", dap1 = "dap1", dap2 = "dap2", dap2est =
  "dap2est", ht1 = "ht1", ht2 = "ht2", ht2est = "ht2est", volume1 =
  "volume1", volume2 = "volume2", volume2est = "volume2est"),
  groupBy = "parcela", save = NULL, percTraining = 0.7,
  paramEstatisticsDAP, paramEstatisticsHT, paramEstatisticsVolume,
  plot = "parcela", ageER = "^.*_", ageRound = NaN, ageInYears = F,
  forcePredict = F)

Arguments

base

the data base

firstAge

the first age to eval

lastAge

the last age to eval

models

list of exclusive for base models

mapper

mapper from labels of fields volume, dap, ht

groupBy

name field of base is group of individuals

save

list of param to save the files

percTraining

percentage that will be reserved for training (default 0.70)

paramEstatisticsDAP

parameters to pass to function 'fnAvaliaEstimativas'

paramEstatisticsHT

analogous to paramEstatisticsDAP

paramEstatisticsVolume

analogous to paramEstatisticsDAP

plot

is list of plots to function roundAges

ageER

regex used to discover age in names from dataframe in listOfdata

ageRound

synchronize begin of ages with an age? what age?

ageInYears

ages are in year?

forcePredict

force the calculation without using predict?

Value

will be returned a list of round ages


evaluates Volume Advanced

Description

this function performs an assessment of estimates of a variable as the forcefulness with expected

Usage

avaliaVolumeAvancado(base, mapeamento = list(dap1 = "dap1", dap2 =
  "dap2", ht1 = "ht1", ht2 = "ht2"), modelos = NULL, salvar = NULL,
  graficos = NULL, estatisticas = NULL, forcePredict = F,
  dividirEm = "parcela", percentualDeTreino = 0.7,
  agruparPor = "parcela", fnCalculaVolume = calculaVolumeDefault)

Arguments

base

data.frame with data

mapeamento

name of field eight and diameter

modelos

list of exclusive for base models

salvar

list of param to save the files

graficos

list of param to plot graphics

estatisticas

list of param to caclc estatistics

forcePredict

force the calculation without using predict?

dividirEm

how divide the base in training and validation

percentualDeTreino

how many percent will stay in the training group?

agruparPor

name field of base is group of individuals

fnCalculaVolume

list of estatistics results

Value

will be returned a result of statistics and ranking of volume


Bias

Description

In statistics, the bias (or bias function) of an estimator is the difference between this estimator's expected value and the true value of the parameter being estimated. An estimator or decision rule with zero bias is called unbiased. Otherwise the estimator is said to be biased.

Usage

bias(observados, estimados)

Arguments

observados

vector of values observed.

estimados

vector of values estimated.

Details

bias = (sum(estimados-observados))/length(observados)

References

see https://en.wikipedia.org/wiki/Bias_of_an_estimator for more details.


Fator A

Description

The linear intercept model,

Usage

calculaA(n, k)

Arguments

n

the size of the vector of regression model data

k

is the number of model parameters

Details

a = (n-1)/(n-k-1)


calculates percentage

Description

With this function, you can calculate the ratio of one quantity or magnitude relative to another evaluated in percentage.

Usage

calculaPerc(valor, observados)

Arguments

valor

number amount you to know the percentage

observados

number relationship to which you want to calculate the percentage, if it is a vector of integers is calculated its average.

Details

calculaPerc = ((valor)/mean(observados))*100


calculates Volume Default

Description

this function calculates the volume based on the height and volume of literature of the equation

Usage

calculaVolumeDefault(ht, dap, ...)

Arguments

ht

is list of height of individuals

dap

is list of diameter of individuals

...

only for compatibility with other functions

Value

will be returned a list of volume calc


coefficient of efficiency

Description

Nash Sutcliffe 1970 model efficiency coefficient is used to assess the predictive power of hydrological models.

Usage

ce(observados, estimados)

Arguments

observados

vector of values observed.

estimados

vector of regression model data.

References

( Nash and Sutcliffe, 1970) https://en.wikipedia.org/wiki/Nash-Sutcliffe_model_efficiency_coefficient for more details.


Ckeck Integer

Description

checks if a variable is integer

Usage

check.integer(x)

Arguments

x

any variable

Value

TRUE if "x" is integer, FALSE if "x" not is interger

Examples

x = 5
check.integer(x)

classifica Classe DAP

Description

the center of the class that the DAP belongs.

Usage

classificaClasseDAP(dfClassesDAP, dap, getNhaClasse = FALSE,
  getNCLASSES = FALSE)

Arguments

dfClassesDAP

a frequency distribution with the attributes $classe and $centro

dap

integer Diameter at breast height

getNhaClasse

get NhaClasse field of dfClassesDAP, default false

getNCLASSES

get NCLASSES field of dfClassesDAP, default false

Examples

dados = defineClasses(1, 10, 2, getDataFrame = TRUE)
classificaClasseDAP(dados,7)

classify field dap

Description

classify field dap as specified amplitude and includes a few fields

Usage

classificarDAP(inventario, amplitude = 1, verbose = FALSE)

Arguments

inventario

the database to update

amplitude

it is amplitude of dap class

verbose

use TRUE to show status of process

Value

data.frame with classeDAP field and other


which parameters are missing?

Description

this function checks whether the labels of the parameters list to move to the functions is sufficient

Usage

contemParametros(funcoes, parametro, addParametro = c(), addArgs = c(),
  exclui3pontos = T)

Arguments

funcoes

is a or set of functions whose param will be verify

parametro

is list whose labels is name of param in funcoes, list of args to funcoes ex list(a="1", b="2")

addParametro

list of param included

addArgs

more param required

exclui3pontos

verify por ... ? in f<-function(a, ...)

Value

will be returned the parameters that have not been reported in parametro and addParametro


Field Converts To Character

Description

converts a column of a dataframe to String

Usage

converteCampoParaCharacter(nomeCampo, base)

Arguments

nomeCampo

the column name you want to convert

base

the column having dataFrame, that you want to convert to String

Value

base dataFrame with a column converted to String

Examples

measurement_date <- c(02/2009,02/2010,02/2011,02/2011)
plot <- c(1,2,3,4)
test <- data.frame(measurement_date,plot)
converteCampoParaCharacter("measurement_date",test)

Create Date Paired

Description

paired a dataframe

Usage

criaDadosPareados(dataFrame, campoChave, campoComparacao, camposPareados,
  camposNaoPareados, progress = TRUE)

Arguments

dataFrame

dataframe that you want to pair dataFrame must contain columns cod_id, ANO_MEDICAO1, ANO_MEDICAO2, DAP1, DAP2, HT1, HT2, ID_PROJETO

campoChave

character the column that will be paired

campoComparacao

character the field used to compare the period of change

camposPareados

vector the fields that will be paired exemple CampoesPareados=c(dap,ht)

camposNaoPareados

the fields he wants to be present without the paired

progress

if TRUE show a progress bar

Value

will be returned a dataframe containing columns cod_id, ANO_MEDICAO1, ANO_MEDICAO2, DAP1, DAP2, HT1, HT2, ID_PROJETO


Create Exclusive Model for a database

Description

this function returns a unique model is variable receive each mapeda variable ex .: criaModeloExclusivo (modeloCamposLeite, c ("age1", "age2", "bai1", "s"))

Usage

criaModeloExclusivo(modeloGenerico, variaveis, palpite = NULL)

Arguments

modeloGenerico

model of pattern criaModeloGenerico

variaveis

list of name fields (strings) in database and model, the order of variables matter

palpite

string containing start values of function of regression

Value

will be returned a function with exclusive model


Create function with generic model

Description

This function creates a generic model that will be a funcao that has parameters for the variables that can be mapped to each different base. her return will be a generic model that should be mapped to be used by the function avaliaEstimativas

Usage

criaModeloGenerico(nome, formula, funcaoRegressao, variaveis,
  palpite = NULL, maisParametros = NULL, requires = NULL)

Arguments

nome

is the name of model

formula

is the string formula begin with y2~y1

funcaoRegressao

is the function that will make the regression, ex.: 'nlsLM'

variaveis

list variables that are present in the model that are field database

palpite

param start of funcaoRegressao

maisParametros

string add in funcaoRegressao, ex lm(y2~y1, data=base, maisParametros)

requires

list of string of packges used to work with funcaoRegressao

Value

will be returned function with generic model to map to a base


define Classes

Description

creates a list with the class interval of a frequency distribution

Usage

defineClasses(limiteMin, limiteMax, amplitude, decrescente = TRUE,
  getDataFrame = FALSE, verbose = FALSE)

Arguments

limiteMin

the lowest list number

limiteMax

the largest number in the list

amplitude

List amplitude

decrescente

order by true decreasing , false increasing

getDataFrame

return a data.frame default false because old uses

verbose

show status default false


define Classes 2

Description

creates a list with the class interval of a frequency distribution

Usage

defineClasses2(dados, amplitude)

Arguments

dados

a vector of numbers

amplitude

integer Class amplitude range

Examples

dados <- c(1,2,3,4)
defineClasses2(dados,2)

Estatistics

Description

this function returns a data.frame containing fields observado and estimado

Usage

estatisticas(observado, estimado, dfEstatisticas = NULL, ...)

Arguments

observado

list containing the observations of variable

estimado

list containing estimates of variable

dfEstatisticas

a data.frame

...

only for compatibility with other functions

Value

will be returned a list with data.frame with observado and estimado fields and other with statictcs of model add


BIAS Estatistics

Description

this function returns a data.frame containing fields bias

Usage

estatisticasBIAS(observado, estimado, dfEstatisticas = NULL, ...)

Arguments

observado

list containing the observations of variable

estimado

list containing estimates of variable

dfEstatisticas

a data.frame

...

only for compatibility with other functions

Value

will be returned data.frame with bias


percent BIAS Estatistics

Description

this function returns a data.frame containing fields biasPERCENTUAL

Usage

estatisticasBiasPERCENTUAL(observado, estimado, dfEstatisticas, ...)

Arguments

observado

list containing the observations of variable

estimado

list containing estimates of variable

dfEstatisticas

a data.frame with field bias

...

only for compatibility with other functions

Value

will be returned data.frame with biasPERCENTUAL


CE Estatistics

Description

this function returns a data.frame containing fields

Usage

estatisticasCE(observado, estimado, dfEstatisticas = NULL, ...)

Arguments

observado

list containing the observations of variable

estimado

list containing estimates of variable

dfEstatisticas

a data.frame

...

only for compatibility with other functions

Value

will be returned data.frame with CE


Correlacion Estatistics

Description

this function returns a data.frame containing fields corr

Usage

estatisticasCORR(observado, estimado, dfEstatisticas = NULL, ...)

Arguments

observado

list containing the observations of variable

estimado

list containing estimates of variable

dfEstatisticas

a data.frame

...

only for compatibility with other functions

Value

will be returned data.frame with corr field


Percent Correlacion Estatistics

Description

this function returns a data.frame containing fields corr_PERCENTUAL

Usage

estatisticasCorrPERCENTUAL(observado, estimado, dfEstatisticas, ...)

Arguments

observado

list containing the observations of variable

estimado

list containing estimates of variable

dfEstatisticas

a data.frame with corr field

...

only for compatibility with other functions

Value

will be returned data.frame with corr_PERCENTUAL field


Co variance Estatistics

Description

this function returns a data.frame containing fields cv

Usage

estatisticasCV(observado, estimado, ajuste = NULL,
  dfEstatisticas = NULL, baseDoAjuste = NULL, formulaDoAjuste = NULL,
  ...)

Arguments

observado

list containing the observations of variable

estimado

list containing estimates of variable

ajuste

is ajust obtained a function like lm or nlsLM

dfEstatisticas

a data.frame

baseDoAjuste

data.frame optional

formulaDoAjuste

formula used in ajust

...

only for compatibility with other functions

Value

will be returned data.frame with cv


Percent Co variance Estatistics

Description

this function returns a data.frame containing fields cvPERCENTUAL

Usage

estatisticasCvPERCENTUAL(observado, estimado, dfEstatisticas, ...)

Arguments

observado

list containing the observations of variable

estimado

list containing estimates of variable

dfEstatisticas

a data.frame with cv field

...

only for compatibility with other functions

Value

will be returned data.frame with cvPERCENTUAL


MAE Estatistics

Description

this function returns a data.frame containing fields mae

Usage

estatisticasMAE(observado, estimado, dfEstatisticas = NULL, ...)

Arguments

observado

list containing the observations of variable

estimado

list containing estimates of variable

dfEstatisticas

a data.frame

...

only for compatibility with other functions

Value

will be returned data.frame with mae


R2 Estatistics for linear models

Description

this function returns a data.frame containing fields r2

Usage

estatisticasR2(observado, estimado, dfEstatisticas = NULL,
  ajuste = NULL, intercepto = TRUE, formulaDoAjuste = NULL,
  baseDoAjuste = NULL, ...)

Arguments

observado

list containing the observations of variable

estimado

list containing estimates of variable

dfEstatisticas

a data.frame

ajuste

is ajust obtained a function like lm or nlsLM

intercepto

intercepts?

formulaDoAjuste

formula used in ajust

baseDoAjuste

data.frame optional

...

only for compatibility with other functions

Value

will be returned data.frame with r2


Residuals Estatistics

Description

this function returns a data.frame containing field residuoPERCENTUAL

Usage

estatisticasResiduoPERCENTUAL(observado, estimado, dfEstatisticas = NULL,
  ...)

Arguments

observado

list containing the observations of variable

estimado

list containing estimates of variable

dfEstatisticas

a data.frame containing field residuo

...

only for compatibility with other functions

Value

will be returned data.frame with percent Residuals field


Residuals Estatistics

Description

this function returns a data.frame containing field residuo

Usage

estatisticasResiduos(observado, estimado, dfEstatisticas = NULL, ...)

Arguments

observado

list containing the observations of variable

estimado

list containing estimates of variable

dfEstatisticas

a data.frame

...

only for compatibility with other functions

Value

will be returned data.frame with Residuals field


RMSE Estatistics

Description

this function returns a data.frame containing fields rmse

Usage

estatisticasRMSE(observado, estimado, dfEstatisticas = NULL, ...)

Arguments

observado

list containing the observations of variable

estimado

list containing estimates of variable

dfEstatisticas

a data.frame

...

only for compatibility with other functions

Value

will be returned data.frame with RMSE calc


percent RMSE Estatistics

Description

this function returns a data.frame containing fields rmsePERCENTUAL

Usage

estatisticasRmsePERCENTUAL(observado, estimado, dfEstatisticas, ...)

Arguments

observado

list containing the observations of variable

estimado

list containing estimates of variable

dfEstatisticas

a data.frame containing field rmse

...

only for compatibility with other functions

Value

will be returned data.frame with rmse PERCENTUAL calc


RRMSE Estatistics

Description

this function returns a data.frame containing fields RRMSE

Usage

estatisticasRRMSE(observado, estimado, dfEstatisticas = NULL, ...)

Arguments

observado

list containing the observations of variable

estimado

list containing estimates of variable

dfEstatisticas

a data.frame

...

only for compatibility with other functions

Value

will be returned data.frame with rrmse


Evaluate Age Based

Description

This function evaluates the volume of past data frames based on the parameter 'listOfdata'

Usage

evalAgeBased(listOfdata, mapper = list(volume2 = "volume2", volume2est =
  "volume2est", dap2 = "dap2", dap2est = "dap2est", ht2 = "ht2", ht2est =
  "ht2est"), fnAvaliaEstimativas = avaliaEstimativas,
  paramEstatisticsDAP, paramEstatisticsHT, paramEstatisticsVolume,
  titulos = "paste(\"Idade\", idade)", ageER = "^.*_",
  nameModel = NULL)

Arguments

listOfdata

the list that contains the data frames predicts

mapper

mapper from labels of fields volume, dap, ht

fnAvaliaEstimativas

funcion to evaluate dataframes of listOfdata

paramEstatisticsDAP

parameters to pass to function 'fnAvaliaEstimativas'

paramEstatisticsHT

analogous to paramEstatisticsDAP

paramEstatisticsVolume

analogous to paramEstatisticsDAP

titulos

customize titles of grafics

ageER

regex used to discover age in names from dataframe in listOfdata

nameModel

name of model used to predict to generate listOfdata optional

Value

will be returned a list of round ages


Fator Bias

Description

The bias factor indicates the average of the observed values is above or below the equity line.

Usage

fator_bias(observados, estimados, n)

Arguments

observados

vector of values observed.

estimados

vector of values estimated.

n

the size of the vector of regression model data

Details

fator_bias = 10^(sum(log(estimados/observados)/n)) #' @references see https://www.sciencedirect.com/science/article/pii/S0165176599001949 for more details.


Generates function to work with a model

Description

this function generates unique model given: A formula and a guess (optional: name, funcaoRegressao, maisParametros, requires - proidido: custom)] or[A string saying how the return will be obtained eg custom = "lm (dap2 dap1 ~ * b 0)" (if the formula can not be passed just go empty, ex .: formula = "")]

Usage

geraModelo(nome = "modelo sem nome", formula,
  funcaoRegressao = "nlsLM", palpite = NULL, maisParametros = NULL,
  requires = NULL, customizado = NULL)

Arguments

nome

is the name of model

formula

is the string formula begin with y2~y1

funcaoRegressao

is the function that will make the regression, ex.: 'nlsLM'

palpite

param start of funcaoRegressao

maisParametros

string add in funcaoRegressao, ex lm(y2~y1, data=base, maisParametros)

requires

list of string of packges used to work with funcaoRegressao

customizado

if you want to write as the return will be obtained report as a string

Value

will be returned a function with exclusive model


Get Year Measurement

Description

using column_name_measurement_date column in the form MM/YYYY creates a new column with the name "ANO_MEDICAO" in YYYY format

Usage

getAnoMedicao(dataFrame, column_name_measurement_date, column_name_plot)

Arguments

dataFrame

that has the column DATE(MM/YYYY) and a ID column_name_plot

column_name_measurement_date

column with a date format

column_name_plot

a column of dataFrame, identification of plot (ID_plot)

Value

dataFrame dataframe that has columns column_name_measurement_date, column_name_plot, ANO_MEDICAO

Examples

column_name_measurement_date <- c("02/2009","02/2010","02/2011","02/2012")
column_name_plot <- c(1,2,3,4)
test <- data.frame(column_name_measurement_date,column_name_plot)
getAnoMedicao(test,"column_name_measurement_date","column_name_plot")

get database Of Ajust

Description

this function returns the database used in the setting

Usage

getBaseOfAjust(ajuste)

Arguments

ajuste

is ajust obtained a function like lm or nlsLM

Value

will be returned a string which is the database of ajust


Get List of DAP Classes

Description

this function return a list of data.frame where each contains a number of dap classes according to reported basis

Usage

getClasses(base, amplitude, verbose = FALSE)

Arguments

base

the data.frame containing fields limiteMin, limiteMax of parcela and idadearred

amplitude

it is amplitude of dap class

verbose

use TRUE to show status of process

Value

list of data.frame


get Columns used in Ajust

Description

this function returns an array with the column names that are on the model and reported basis or basis used in ajust

Usage

getColumnsOfAjust(ajuste, dfDados = NULL, excludeY1andY2 = T)

Arguments

ajuste

is ajust obtained a function like lm or nlsLM

dfDados

data.frame optional

excludeY1andY2

delete Y1 and Y2 fields? del formula(y1~y2...)

Value

will be returned list of columns used in ajust


get Columns Of Base present in the string

Description

this function returns the columns of a base whose names are present in the string strColumns

Usage

getColumnsOfBase(base, strColumns)

Arguments

base

data.frame

strColumns

string containing name fields of the base

Value

will be returned list with fields whose name are present in the string


get Formula Exclusive Of Ajust

Description

this function returns the formula of the model used in ajust

Usage

getFormulaExclusivaOfAjust(ajuste)

Arguments

ajuste

is ajust obtained a function like lm or nlsLM

Value

will be returned a string which is the formula of ajust


Get ggplot2 Grapic observed versus estimated

Description

this function displays/saves/returns a Graphical ggplot2 illustrating the difference between the observed and estimated

Usage

getggplot2GraphicObservadoXEstimado(titulo = "observadoXestimado",
  nome = "observadoXestimado", observado, estimado,
  identificadorIndividual = NULL, identificadorGrupal = NULL,
  showTestF = TRUE, TestFposition = 4,
  titleIdentificadorGrupal = NULL, save = NULL, labsX = "observado",
  labsy = "estimado", nomeParaExibir = NULL, environ = 1,
  extensao = ".png", ...)

Arguments

titulo

is the title graphic

nome

name of file case save

observado

list containing the observations of variable

estimado

list containing estimates of variable

identificadorIndividual

list containing 'id' of individuals

identificadorGrupal

list containing group of individuals

showTestF

draw results of test F in graphic?

TestFposition

show one of the four corners of the graph clockwise

titleIdentificadorGrupal

title of Legend of the groups

save

If you want to save enter the directory as a string

labsX

label x

labsy

label y

nomeParaExibir

This is the name to display the graph as a function after the completion of this

environ

environment in which the function to display the ggplot2 must be saved

extensao

type of image that will be saved

...

only for compatibility with other functions

Value

will be returned the graphical generated by ggplot2


Get Histogram of Residuals absolute

Description

this function displays/saves a histogram graph illustrating the frequency of waste in classes

Usage

getGraphicHistogram(titulo = "residuos", nome = "observadoXestimado",
  estatisticas, save = NULL, vetorial = T, ...)

Arguments

titulo

is the title graphic

nome

name of file case save

estatisticas

data.frame containing field 'residuo'

save

If you want to save enter the directory as a string

vetorial

save picture in vector type? (Default TRUE)

...

only for compatibility with other functions


Get Graphic Observed X Estimated

Description

this function display/save a graphic scatter.smooth illustrating the difference between the observed and estimated

Usage

getGraphicObservadoXEstimado(titulo = "observadoXestimado",
  nome = "observadoXestimado", observado, estimado, showTestF = TRUE,
  save = NULL, labsX = "observado", labsy = "estimado",
  vetorial = T, ...)

Arguments

titulo

is the title graphic

nome

name of file case save

observado

list containing the observations of variable

estimado

list containing estimates of variable

showTestF

draw results of test F in graphic?

save

If you want to save enter the directory as a string

labsX

label x

labsy

label y

vetorial

save picture in vector type? (Default TRUE)

...

only for compatibility with other functions


Get Graphic Residuals absolute

Description

this function displays/saves a graph illustrating the distribution scatter.smooth of residues

Usage

getGraphicResiduoAbs(titulo = "residuo absoluto",
  nome = "observadoXestimado", strVariavelXResiduo = NULL,
  estatisticas, save = NULL, labsX = "observacao",
  labsy = "residuos", vetorial = T, ...)

Arguments

titulo

is the title graphic

nome

name of file case save

strVariavelXResiduo

list containing variable for compare with residuals

estatisticas

data.frame containing field 'residuo'

save

If you want to save enter the directory as a string

labsX

label x

labsy

label y

vetorial

save picture in vector type? (Default TRUE)

...

only for compatibility with other functions


Get Graphic Residuals percent

Description

this function displays/saves a graph illustrating the distribution scatter.smooth of residues

Usage

getGraphicResiduoPerc(titulo = "Residuo Percentual (%)",
  nome = "observadoXestimado", strVariavelXResiduo = NULL,
  estatisticas, save = NULL, labsX = "observacao",
  labsy = "residuos", vetorial = T, ...)

Arguments

titulo

is the title graphic

nome

name of file case save

strVariavelXResiduo

list containing variable for compare with residuals

estatisticas

data.frame containing field 'residuoPERCENTUAL'

save

If you want to save enter the directory as a string

labsX

label x

labsy

label y

vetorial

save picture in vector type? (Default TRUE)

...

only for compatibility with other functions


get Parametros Of Model

Description

this function retona columns the base of the parameter or setting present in the model

Usage

getParametrosOfModel(ajuste, base = NULL, formula = NULL)

Arguments

ajuste

is ajust obtained a function like lm or nlsLM

base

optional data.frame whose fields name is present in formula

formula

string containing name fields of the base

Value

will be returned list of columns used in ajust or in formula


ifrm

Description

if the object does not exist an error will not happen.

Usage

ifrm(obj, env = globalenv())

Arguments

obj

the object that you want to remove

env

The global environment

Examples

a = 5
ifrm(a)
ifrm(b)

is finite data frame

Description

check if a data.frame has any non-finite elements

Usage

isfinitedataframe(obj)

Arguments

obj

any object

Value

TRUE if "x" is finite, FALSE if "x" is not finite

Examples

date <- c("02/2009","02/2010","02/2011","02/2012")
x <- c(1,2,3,4)
test <- data.frame(x,date)
isfinitedataframe(test)
isfinitedataframe(x)

List to DataFrame

Description

converts a list in a dataframe

Usage

listToDataFrame(dlist)

Arguments

dlist

a list

Examples

a <- 1:5
listToDataFrame(a)
b = listToDataFrame(a)

mean absolute error (mae)

Description

is a quantity used to measure how close forecasts or predictions are to the eventual outcomes. The mean absolute error is given by.

Usage

mae(observados, estimados)

Arguments

observados

vector of values observed.

estimados

vector of regression model data.

Details

mae = mean(abs(observados-estimados))

Value

Function that returns Mean Absolute Error

References

see https://en.wikipedia.org/wiki/Mean_absolute_error for more details.


Mean squared error

Description

the MSE is the mean of the square of the errors, corresponding to the expected value of the squared error loss or quadratic loss. The difference occurs because of randomness or because the estimator doesn't account for information that could produce a more accurate estimate.

Usage

mse(observados, estimados, k)

Arguments

observados

vector of values observed.

estimados

vector of regression model data.

k

the number of model parameters

Details

mse = (sum(estimados-observados)^2)/(length(observados)-k)

References

See https://en.wikipedia.org/wiki/Mean_squared_error for more details.


mspr

Description

average square of the prediction errors .

Usage

mspr(observados, estimados, nValidacao)

Arguments

observados

vector of values observed.

estimados

vector of regression model data.

nValidacao

number of cases in the validation data set.

References

JESUS, S. C.; MIURA, A. K. Analise de regressao linear multipla para estimativa do indice de vegetacao melhorado (EVI) a partir das bandas 3 4 e 5 do sensor TM/Landsat 5. In: SIMPOSIO BRASILEIRO DE SENSORIAMENTO REMOTO, 14. (SBSR), 2009, Natal. Anais... Sao Jose dos Campos: INPE, 2009. p. 1103-1110. DVD, On-line. ISBN 978-85-17-00044-7. (INPE-15901-PRE/10511)


Predict

Description

this function is the replacement predict, she tries to predict if the return zero predict it calculates the prediction with the coefficients reported in the parameter setting

Usage

predizer(ajuste, newdata, force = FALSE, ...)

Arguments

ajuste

is ajust obtained a function like lm or nlsLM

newdata

dataframe where fields will be update

force

force the calculation without using predict?

...

only for compatibility with other functions

Value

will be returned list of values predicts


Project Base Oriented

Description

this function build a list of dataframe with projects of ages between 'firstAge' and 'lastAge' params

Usage

projectBaseOriented(firstAge = NaN, lastAge = NaN, fitDAP, fitHT, base,
  mapper = list(age1 = "idadearred1", dap1 = "dap1", dap2 = "dap2", ht1 =
  "ht1", ht2 = "ht2"), calcVolume = calculaVolumeDefault,
  forcePredict = F)

Arguments

firstAge

the first age to predict

lastAge

the last age to predict

fitDAP

a fit get function inherit lm to DAP

fitHT

a fit get function inherit lm to HT

base

data base

mapper

the label used in fields to age, dap and ht

calcVolume

function to calc volume

forcePredict

force calc base coefficients or se predict()?

Value

will be returned a list of volume predict to ages in dataframe and/or param


R21a

Description

To avoid any problems and confudion on the part of the data analyst, it seems a safe recommendation to use R21a consistently for any type of model with the appropeiate a value, rather than ajusting any of the other

Usage

R21a(observados, estimados, k)

Arguments

observados

vector of values observed.

estimados

vector of values estimated.

k

is the number of model parameters

Details

R21a <- 1-a*(1 - R21)


R29a

Description

To avoid any problems and confusion on the part of the data analyst, it seems a safe recommendation to use R21a consistently for any type of model with the appropeiate a value, rather than adjusting any of the other.

Usage

R29a(observados, estimados, k)

Arguments

observados

vector of values observed.

estimados

vector of values estimated.

k

is the number of model parameters

Details

R29a <- 1-a*(1 - R29)


calculates residue percentage

Description

this function calculates the vector residue percentage.

Usage

residuoPerc(observados, estimados)

Arguments

observados

vector of values observed.

estimados

vector of values estimated.

Details

calculaPerc = ((valor)/mean(observados))*100


return value

Description

this feature is designed to fix variables that its content was a command

Usage

retornaValor(valor)

Arguments

valor

any variable

Value

the variable converted to its value

Examples

a = 5
retornaValor(a)

Root Mean Square Error

Description

The root-mean-square error (RMSE) is a frequently used measure of the differences between values (sample and population values) predicted by a model or an estimator and the values actually observed.

Usage

rmse(observados, estimados)

Arguments

observados

vector of values observed.

estimados

vector of regression model data.

Details

rmse = sqrt(mean((observados - estimados)^2))

References

See https://en.wikipedia.org/wiki/Root-mean-square_deviation for more details.


Round Ages

Description

this function approaching the age to the nearest age as an integer

Usage

roundAge(plots, ages, inYears = F, firstAge = NaN)

Arguments

plots

is list of plots

ages

is list of age

inYears

ages are in year?

firstAge

synchronize begin of ages with an age? what age?

Value

will be returned a list of round ages


relative root mean square error

Description

relative root mean square error (RRMSE) is calculated by dividing the RMSE by the mean observed data

Usage

rrmse(observados, estimados)

Arguments

observados

vector of values observed.

estimados

vector of regression model data.


save function with Model

Description

save function with Model of type criaModeloGenerico or criaModeloExclusivo

Usage

salvaModelo(modelo, diretorio = "")

Arguments

modelo

function with Model the save

diretorio

directory to save the file, if not informed saved in the work directory


Data Separates

Description

divides the dataFrame as the percentage defined in percTraining enabling apply and measure the performance of the regression equation.

Usage

separaDados(dataFrame, fieldName, percTraining = 0.7, seed = NULL)

Arguments

dataFrame

source of data

fieldName

column of dataFrame that will be applied regression

percTraining

percentage that will be reserved for training (default 0.70)

seed

integer that determines how the sample is randomly chosen (default NULL)


Standard Error of Estimate

Description

Measures the variability, or scatter of the observed values around the regression line

Usage

syx(observados, estimados, n, p)

Arguments

observados

vector of values observed.

estimados

vector of values estimated.

n

the amount of values observed

p

the size of the vector of regression model data


Standard Error of Estimate Percentage

Description

Measures the variability, or scatter of the observed values around the regression line

Usage

syxPerc(syx, observados)

Arguments

syx

result of the function syx(Standard Error of Estimate).

observados

vector of values observed.


Check de type of Column

Description

this function returns the type of a column of a dataFrame, if it is numeric or character.

Usage

verificaTipoColuna(coluna)

Arguments

coluna

column of dataframe

Examples

ID_REGIAO <- c(1,2,3,4)
CD_PLANTIO <- c("ACD","CDB","CDC","CDD")
test <- data.frame(ID_REGIAO,CD_PLANTIO)
verificaTipoColuna(test$ID_REGIAO)

whichmedian

Description

vector position that has its closest median value

Usage

whichmedian(x)

Arguments

x

a vector of numbers

Value

vector position that has its closest median value

Examples

dados <- c(1,2,3,4,9,5,6)
whichmedian(dados)