export {tipsae}R Documentation

Exporting Results of a Small Area Model Fitting

Description

The function export() allows for exporting model estimates in CSV format.

Usage

export(x, file, type = "all", ...)

Arguments

x

An object of class estimates_fitsae.

file

A character string indicating the path (if different from the working directory) and filename of the CSV to be created. It should end with .csv.

type

An option between "in", "out" and "all", indicating whether to export only in or out-of-sample areas or both.

...

Additional arguments of write.csv function from utils package can be indicated.

Value

A CSV file is created in the working directory, or at the given path, exporting the estimates_fitsae object given as input.

See Also

extract to produce the input object and write.csv.

Examples

## Not run: 
library(tipsae)

# loading toy dataset
data("emilia_cs")

# fitting a model
fit_beta <- fit_sae(formula_fixed = hcr ~ x, data = emilia_cs, domains = "id",
                    type_disp = "var", disp_direct = "vars", domain_size = "n",
                    # MCMC setting to obtain a fast example. Remove next line for reliable results.
                    chains = 1, iter = 150, seed = 0)

# check model diagnostics
summ_beta <- summary(fit_beta)

# extract model estimates
HB_estimates <- extract(summ_beta)

# export model estimates
export(HB_estimates, file = "results.csv", type = "all")

## End(Not run)



[Package tipsae version 1.0.1 Index]