Learn R Programming

bayesQRsurvey (version 0.1.4)

print.bayesQRsurvey: Print methods for bayesQRsurvey model objects

Description

print.bayesQRsurvey is an S3 method that prints the content of an S3 object of class bqr.svy or mo.bqr.svy to the console.

Usage

# S3 method for bqr.svy
print(x, digits = 3, ...)

# S3 method for mo.bqr.svy print(x, digits = 3, max_rows = NULL, ...)

Arguments

x

An object of class "bqr.svy" or "mo.bqr.svy", returned by bqr.svy or mo.bqr.svy.

digits

Integer specifying the number of decimal places to print. Defaults to 3.

...

Additional arguments that are passed to the generic print() function.

max_rows

Optional integer indicating the maximum number of coefficient rows to display for each quantile. If NULL, all rows are printed (only used in print.mo.bqr.svy).

Examples

Run this code
# \donttest{
set.seed(123)
N    <- 10000
x1_p <- runif(N, -1, 1)
x2_p <- runif(N, -1, 1)
y_p  <- 2 + 1.5 * x1_p - 0.8 * x2_p + rnorm(N)

# Generate sample data
n <- 500
z_aux <- rnorm(N, mean = 1 + y_p, sd = .5)
p_aux <- 1 / (1 + exp(2.5 - 0.5 * z_aux))
s_ind <- sample(1:N, n, replace = FALSE, prob = p_aux)
y_s   <- y_p[s_ind]
x1_s  <- x1_p[s_ind]
x2_s  <- x2_p[s_ind]
w     <- 1 / p_aux[s_ind]
data  <- data.frame(y = y_s, x1 = x1_s, x2 = x2_s, w = w)

# Fit a model
fit1 <- bqr.svy(y ~ x1 + x2, weights = w, data = data,
                niter = 2000, burnin = 500, thin = 2)

print(fit1)
# }

Run the code above in your browser using DataLab