normal1sd: Estimation and Inference for Conditional Quantiles of a...

Description Usage Arguments Details Value Warning Author(s) See Also Examples

Description

Maximum likelihood estimation of the standard deviation, including inference for conditional quantiles, of a univariate normal distribution.

Usage

1
2
3
            normal1sdff(zero = NULL, link = "loglink",
                        fixed.mean = 0, p.quant = NULL,
                        var.arg = FALSE)

Arguments

zero

Allows to model the single linear predictor in this family function as intercept–only. See below for important details about this.

link

This is the link function applied to the standard deviation. If var.arg is TRUE, then link is applied to the variance. The default is loglink. For inference on conditional quantiles entered at p.quant, however, it must be manually changed to normal1sdQlink. See below for further details.

fixed.mean

Numeric, a vector or a matrix. It allocates the (fixed) mean of the response in the fitting process. See below for further details.

p.quant

Numeric. A prototype vector of probabilities indicating the quantiles of interest, when quantile regression is to be performed.

var.arg

If TRUE, then the variance is estimated, else the standard deviation is used.

Details

This family function is a variant of uninormal to estimate the standard deviation of a Normal distribution with known mean. The estimated values are returned as the fitted values, unlike some other family functions where the mean is returned as fitted values. However, here the mean is assumed to be known.

By default, the response is supposedly centered on its mean, that is, fixed.mean = 0. Change this accordingly: For a single response or multiple responses, fixed.mean must be a numeric vector where each entry is the mean of each response, only if the mean is fixed. When the mean is not constant, fixed.mean must be matrix with the number of columns matching the number of responses.

Quantile regression: The (single) linear/additive predictor by default is the log of the standard deviation. However, if quantile regression is of primary interest, then the response must be entered using the function Q.reg, and the corresponding p–quantiles through p.quant in the vglm or vgam call. Additionally, set normalsdQlink as the link function via the argument link.

This family VGAM function handles multiple responses.

Value

An object of class "vglmff". See vglmff-class for further details.

Warning

Be aware of the argument zero: by default, the single linear/additive predictor in this family function, say η, can be modeled in terms of covariates, i.e., zero = NULL. To model η as intercept–only, set zero = "sd".

See zero for more details about this.

Author(s)

V. Miranda.

See Also

normal1sdQlink, loglink, uninormal, CommonVGAMffArguments, zero, vgam, vglm.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
   set.seed(121216)
   my.mean <- -1      #  Mean (CONSTANT)
   my.sd   <- 2.5
   y <- rnorm(100, mean = my.mean, sd = 2.0)      # Generate some data.
   normdat <- data.frame(y = y)                   # Setting up our data.
 
    
   # Plotting the data
     plot(y, main = c("Y ~ Normal ( mean(known), sd = 2.5 ). "),
          ylab = "The data", pch = 20, 
          xlim = c(0, 100), ylim = c(-7, 7), col = "blue")
     abline(h = 0, v = 0, lwd = 2, col = "black")
   

   ### EXAMPLE 1. Estimate the SD with two responses. The mean is fixed. ###
   
   fit1 <- vglm(cbind(y, y) ~ 1, family = normal1sdff(fixed.mean = my.mean), 
               data = normdat, trace = TRUE, crit = "coef")
   Coef(fit1) 
   summary(fit1)
    
    
   ### EXAMPLE 2. Quantile regression. The link normal1sdQlink() is used. ###
  
   my.p <- c(25, 50, 75) / 100  # Quantiles 25%, 50% and 75% are of interest.
   
   fit2 <- vglm(Q.reg(y, length.arg = 3) ~ 1, 
                family = normal1sdff(fixed.mean = my.mean, p.quant = my.p,
                                   link = normal1sdQlink), 
                data = normdat, trace = TRUE, crit = "coef")
    summary(fit2)
    head(predict(fit2))
    constraints(fit2)


   ### EXAMPLE 3. Complete the plot. Quantiles matching. ###
   
   
   ( my.c3Q <- coef(fit2, matrix = TRUE) )
   with(normdat, lines(rep(my.c3Q[1], 100), col = "tan"   , lty = "dotted", lwd = 2))
   with(normdat, lines(rep(my.c3Q[2], 100), col = "orange", lty = "dotted", lwd = 2))
   with(normdat, lines(rep(my.c3Q[3], 100), col = "brown1", lty = "dotted", lwd = 2))
   legend(20, 7.0, c("Percentil 75", "Percentil 50", "Percentil 25"),
          col = c("brown1", "orange", "tan"),
          lty = rep("dotted", 3), lwd = rep(2, 3), cex = 0.75)
   

VGAMextra documentation built on May 24, 2021, 9:07 a.m.