R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(DirichletReg)
Loading required package: Formula
Loading required package: rgl
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/DirichletReg/DirichletReg-package.Rd_%03d_medium.png", width=480, height=480)
> ### Name: DirichletReg-package
> ### Title: The 'DirichletReg' Package
> ### Aliases: DirichletReg DirichletReg
> ### Keywords: package
>
> ### ** Examples
>
> example(plot.DirichletRegData)
pl.DRD> # plot of "Sand" in the Arctic Lake data set
pl.DRD> plot(DR_data(ReadingSkills[, 1]), main="Reading Accuracy")
only one variable in [0, 1] supplied - beta-distribution assumed.
check this assumption.
pl.DRD> # ternary plot of Arctic Lake data
pl.DRD> plot(DR_data(ArcticLake[, 1:3]), a2d = list(colored = FALSE))
Warning in DR_data(ArcticLake[, 1:3]) :
not all rows sum up to 1 => normalization forced
> example(DirichReg)
DrchRg> ALake <- ArcticLake
DrchRg> ALake$Y <- DR_data(ALake[,1:3])
Warning in DR_data(ALake[, 1:3]) :
not all rows sum up to 1 => normalization forced
DrchRg> # fit a quadratic Dirichlet regression models ("common")
DrchRg> res1 <- DirichReg(Y ~ depth + I(depth^2), ALake)
DrchRg> # fit a Dirichlet regression with quadratic predictor for the mean and
DrchRg> # a linear predictor for precision ("alternative")
DrchRg> res2 <- DirichReg(Y ~ depth + I(depth^2) | depth, ALake, model="alternative")
DrchRg> # test both models
DrchRg> anova(res1, res2)
Analysis of Deviance Table
Model 1: DirichReg(formula = Y ~ depth + I(depth^2), data = ALake)
Model 2: DirichReg(formula = Y ~ depth + I(depth^2) | depth, data = ALake,
model = "alternative")
Deviance N. par Difference df Pr(>Chi)
Model 1 -217.99 9
Model 2 -215.68 8 2.3136 1 0.1282
DrchRg> res1
Call:
DirichReg(formula = Y ~ depth + I(depth^2), data = ALake)
using the common parametrization
Log-likelihood: 109 on 9 df (162 BFGS + 2 NR Iterations)
-----------------------------------------
Coefficients for variable no. 1: sand
(Intercept) depth I(depth^2)
1.4361967 -0.0072382 0.0001324
-----------------------------------------
Coefficients for variable no. 2: silt
(Intercept) depth I(depth^2)
-0.0259705 0.0717450 -0.0002679
-----------------------------------------
Coefficients for variable no. 3: clay
(Intercept) depth I(depth^2)
-1.7931487 0.1107906 -0.0004872
-----------------------------------------
DrchRg> summary(res2)
Call:
DirichReg(formula = Y ~ depth + I(depth^2) | depth, data = ALake, model =
"alternative")
Standardized Residuals:
Min 1Q Median 3Q Max
sand -1.7598 -0.7459 -0.1833 1.0148 2.7250
silt -1.1459 -0.5379 -0.1581 0.2467 1.5572
clay -1.9269 -0.6106 -0.0617 0.6294 1.9976
MEAN MODELS:
------------------------------------------------------------------
Coefficients for variable no. 1: sand
- variable omitted (reference category) -
------------------------------------------------------------------
Coefficients for variable no. 2: silt
Estimate Std. Error z value Pr(>|z|)
(Intercept) -1.2885187 0.3835030 -3.360 0.00078 ***
depth 0.0706992 0.0147385 4.797 1.61e-06 ***
I(depth^2) -0.0003247 0.0001210 -2.684 0.00727 **
------------------------------------------------------------------
Coefficients for variable no. 3: clay
Estimate Std. Error z value Pr(>|z|)
(Intercept) -2.9754613 0.4973405 -5.983 2.19e-09 ***
depth 0.1064013 0.0180002 5.911 3.40e-09 ***
I(depth^2) -0.0005161 0.0001429 -3.612 0.000303 ***
------------------------------------------------------------------
PRECISION MODEL:
------------------------------------------------------------------
Estimate Std. Error z value Pr(>|z|)
(Intercept) 1.324382 0.357461 3.705 0.000211 ***
depth 0.041773 0.006604 6.325 2.53e-10 ***
------------------------------------------------------------------
Significance codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Log-likelihood: 107.8 on 8 df (96 BFGS + 2 NR Iterations)
AIC: -199.7, BIC: -186.4
Number of Observations: 39
Links: Logit (Means) and Log (Precision)
Parametrization: alternative
>
>
>
>
>
> dev.off()
null device
1
>