ident_model {forestmangr}R Documentation

Identity of a Model Test

Description

Function for using the Identity of a Model test, as described by Regazzi (1999).

Usage

ident_model(
  df,
  factor,
  reduced_model,
  filter = NA,
  gray_scale = TRUE,
  signif = 0.05,
  font = "serif",
  output = "table",
  eq = TRUE
)

Arguments

df

a data frame.

factor

Quoted name of the factor variable used to differentiate the data projects in the test.

reduced_model

Quoted or unquoted reduced model used in the test. The variables mentioned in the model must exist in the provided data frame. X and Y sides of the model must be separated by "~".

filter

Optional argument. If supplied with levels present in factor, only these levels will be used in the test. NA.

gray_scale

If TRUE a gray scale will be used in the plots. Default: FALSE.

signif

Numeric value for the significance level used in the test. Default: 0.05.

font

font family used in the plots. Can be either "serif" for Times New Roman or "sans" for arial unicode MS. Default: "serif".

output

Defines the type of output. If "table" an anova table with the identity of model test is provided,

eq

if TRUE, A model is adjusted and the equation is shown on the plot. Default TRUE if "plot" a ggplot plot/object representing the test is created, if "table_plot", both anova table and plot are provided, and if "full", a list is provided, with details on the dummies variables created, the reduced and complete models, the anova table and the plot. Default: "table"

Value

A data frame, a ggplot object, or a list, varying according to the output argument.

Author(s)

Sollano Rabelo Braga sollanorb@gmail.com

Marcio leles Romarco de Oliveira marcioromarco@gmail.com

References

Regazzi, A. J. (1999) Teste para verificar a identidade de modelos de regressao e a igualdade de parametros no caso de dados de delineamentos experimentais, Ceres, 46(266), pp. 383–409.

Examples

library(forestmangr)
data("exfm13")
head(exfm13)

# The objective is to know if the diameter's behavior is similar among 3 species.
# For this we'll use a quadratic model. We'll use nitrogen (N) as our X variable.

ident_model(exfm13, "species", dbh ~ N + N2)

# This test shows that there are differences between the species. 
# We can get more details on this using a different output, that will also
# give us a plot:

ident_model(exfm13, "species", dbh ~  N + N2, output = "table_plot",eq=FALSE)

# This gives us only the plot:
ident_model(exfm13, "species", dbh ~  N + N2, output = "table_plot",eq=FALSE)

# And this gives us additional information on the test:
ident_model(exfm13, "species", dbh ~  N + N2, output = "full",eq=FALSE)

# Looking at the plot, it seems that 2 species are behaving very similar, while
# the Pequi species is different from the other 2. We can confirm this by running
# the test in a paired fashion, using the filter argument:

ident_model(exfm13, "species", dbh ~  N + N2,
 filter = c("PEQUI", "SUCUPIRA-PRETA"), output = "table_plot",eq=FALSE)
 
ident_model(exfm13, "species", dbh ~  N + N2, 
filter = c("PEQUI", "VINHATICO"), output = "table_plot",eq=FALSE)

ident_model(exfm13, "species", dbh ~  N + N2, 
filter = c("SUCUPIRA-PRETA", "VINHATICO"), output = "table_plot",eq=FALSE)

# As we imagined, a single model can be used to describe the behavior of
# the "Sucupira-preta" and "Vinhatico" species,
# and a second model is needed to explain the Pequi Variable.

# It's possible to apply a color scale to the plots, and also change it's font to arial:

ident_model(exfm13, "species", dbh ~  N + N2,output="plot",gray_scale=FALSE,font="sans",eq=FALSE)


[Package forestmangr version 0.9.6 Index]