User Interface
The sections below describe the main calls needed to use Grumps. For any functions that are not documented here, simply use ? in the REPL, e.g. ?Variables.
The way that Grumps works is that one first specifies where the data are stored, what specification to use, which estimator to use, etcetera, before calling the functions that actually perform work with these choices. All sections below up to and including the choice of integration method specify things, data object creation and algorithm call create and compute things, and the remainder deals with the retrieval of estimation results and memory conservation.
Data entry
The methods below are used to enter data into Grumps. With Sources()
one specifies where the data can be found and with Variables()
which variables to use from those data sources.
There are two versions of the Variables method, where the main difference is the syntax. Use whichever one you prefer.
Grumps.Sources
— MethodSources(
T = DefaultSourceTypes;
consumers :: Any = nothing,
products :: Any = nothing,
marketsizes :: Any = nothing,
draws :: Any = nothing,
user :: Any = nothing
)
Creates a GrumpsSources object with source type entries of type T where the entries are provided in the optional parameters.
Grumps (potentially) uses four data sources: a data source for consumer-level data, one for product-level data, one for market size information, and one for demographic draws. See Spreadsheet formats for data layouts. Only the product-level data are required, but are by themselves insufficient. For instance, for BLP95 one needs information on products, market sizes, and demographics; for the Grumps CLER estimator one needs all four types of data; for a multinomial logit both consumer and product information are needed. Not all data are needed for all markets. For instance, it is ok for some estimators for there to be consumer-level data in some markets but not others.
The T argument is mostly there to allow for future expansion, so the description below applies to the case in which T = DefaultSourceTypes.
By default, the entries can be nothing, a string, a DataFrame, or a SourceFileType. If an entry is nothing, it means that no such data is to be used. If an entry is a string then it is converted to a SourceFileCSV entry with comma delimiter where the string name is the file name. To use other source file types, create a SourceFileType first. A DataFrame can be passed, also. In all cases other than nothing, data will eventually be (converted to) a DataFrame and parsed from that.
The consumers variable specifies where consumer-level data can be found, the products variable is for the product-level data, marketsizes is for market sizes, and draws is for demographic draws; user has not been implemented yet.
Use the Variables()
method to specify the way the data sources are formatted and the specification to estimate.
Grumps.Variables
— MethodVariables( ;
market :: Symbol = :market,
product :: Symbol = :product,
choice :: Symbol = :choice,
interactions :: Mat{Symbol} = [],
randomcoefficients :: Vec{Symbol} = [],
outsidegood :: String = "outsidegood",
share :: Symbol = :share,
marketsize :: Symbol = :N,
regressors :: Vec{Symbol} = [],
instruments :: Vec{Symbol} = [],
dummies :: Vec{Symbol} = [],
nuisancedummy :: Symbol = :none,
microinstruments :: Mat{Symbol} = [],
user :: Mat{Symbol} = []
)
This method is used to specify regressors, instruments, random coefficients, interactions, variable labels, etcetera, from the sources you have specified in Sources()
. It creates an object of type GrumpsVariables.
For instance, the option market specifies the column heading of the column containing the market descriptor (name). The same is true for all other arguments, except outsidegood which describes the spreadsheet entry that indicates the product is an outside good. The same label for the outside good should be used in all spreadsheets and all markets. Outside good entries should only be used in the consumer micro data and then only if there actually are consumers in the micro data choosing the outside good. All descriptors are case and space sensitive.
There is a separation between variables that go into the individual consumer utility and ones that only go into "mean utility". For instance, interactions tells Grumps which interaction terms to use and randomcoefficients which product level regressors are hit with a random coefficient. By contrast, regressors go into the mean utility component and are regressors in the "second stage" (where β is recovered). One can use the special symbol :constant to indicate a constant is to be used; the spreadsheet need not include a column with that heading.
Note that there are three ways that dummy variables can be entered as second stage regressors, which can be useful to incorporate brand, firm, or market effects into δ. The first is via regressors, in which case the onus is on the user to ensure that they have the correct numerical values. The second possibility is via the dummies argument. For each symbol passed via the dummiesi pass one via the *nuisancedummy argument since it saves both computation time and memory. There can only be at most one categorical variable that can be converted to nuisance dummies, but there can be arbitrarily many categories. These dummies and nuisance dummies are automatically assumed to be exogenous and will be included in the instruments, also.
market refers to the variable containing the market indicator in all input datasets. Strings (e.g. "Amarillo, Texas") work best for the market indicators themselves, but it is not a requirement.
product refers to the variable containing the product indicator in the product dataset. Strings (e.g. "Camry") work best for the product indicators themselves, but it is not a requirement.
choice refers to the variable indicating the choice indicator in the consumer level datasets. Strings work best for the choice indicators themselves, but it is not a requirement. These should take the values of the product column in the products data set or of the outsidegood.
interactions refers to the variables indicating consumer and product variable interactions (each row contains consumer variable, product variable)
randomcoefficients refers to the product level variables that have a random coefficient on them
outsidegood refers to the label used for the outside good
share refers to the label used for the product level share; these are shares where the denominator includes the outside good
marketsize refers to the size of the market (number of people)
regressors refers to the label used for the second stage regressors
instruments refers to the label used for the second stage instruments
dummies refers to discrete variables to be converted to second stage dummy regressors and instruments
nuisancedummy refers to at most one variable to be converted to a second stage dummy regressors and instrument whose coefficient value is of no interest
microinstruments refers to micro instruments, which are only relevant for gmm style procedures
user refers to a list of variables to be added to the consumer-product interactions using a user-specified procedure. This is only needed if the Grumps specification itself does not suffice: see Extending Grumps for details.
Grumps.Variables
— MethodVariables(
microspec :: String,
macrospec :: String,
dummyspec :: String = "",
nuisancedummyspec :: String = "";
market :: String = "market",
product :: String = "product",
outsidegood :: String = "outsidegood",
marketsize :: String = "N",
microinstruments :: String = "",
user :: String = ""
)
This method is used to specify regressors, instruments, random coefficients, interactions, variable labels, etcetera, from the sources you have specified in Sources()
. It creates an object of type GrumpsVariables. There is another method by the same name that accomplishes much the same thing, but has a different user interface.
The method described here takes string arguments, including two mandatory ones, whereas the other method takes optional arguments only, mostly symbols, vectors of symbols, and matrices of symbols that can be passed in arbitrary order using keywords. The current method parses user input before calling the other method.
The option market specifies the column heading of the column containing the market descriptor (name). The same is true for all other arguments, except outsidegood which describes the spreadsheet entry that indicates the product is an outside good. The same label for the outside good should be used in all spreadsheets and all markets. Outside good entries should only be used in the consumer micro data and then only if there actually are consumers in the micro data choosing the outside good. All descriptors are case sensitive.
There is a separation between variables that go into the individual consumer utility and ones that only go into "mean utility". For instance, to specify what goes into individual consumer utility, one could specify
"choice = loginc * msrp + famsize * logfootprint + famsize * van + urban * truck + rc * suv + rc * truck + rc * van"
as the microspec argument to indicate that consumer choice is in the micro data set in a column headed "choice" and that there are four interaction terms and three random coefficients. The interaction terms have the consumer-level variable as the first factor and the product variable as the second argument. In this example the three random coefficients are on the suv, truck, and van variables and these variable names should correspond to the column headings in the product level data set. One can use constant to indicate a constant is used: there is no need to include a constant in one's data.
The macrospec argument takes the form
"share = constant + logmpg + loghp + logfootprint + msrp | constant, logmpg, loghp, logfootprint, logcurbweight, lagplcon"
where share are product-level market shares, everything between = and | represents regressors, and everything after | represents instruments; both regressors and instruments are for the product level moments portion. One can again use constant to indicate a constant is used, which need not be included in one's data.
For the remaining arguments, see the description of the other method Variables()
.
Optimization options
The default optimization options are sensible, in which case this section can be skipped. But for those who want to play with tolerances and such, have at it.
There is one exception, however, and that exception pertains to using less memory. There is a separate section dedicated to that possibility, namely Memory conservation
Grumps.OptimizationOptions
— MethodOptimizationOptions(;
θopt = OptimOptionsθ(),
δopt = OptimOptionsδ(),
threads = GrumpsThreads(),
memsave = false,
maxrepeats = 4,
probtype = :fast,
id = :Grumps
)
Sets the options used for numerical optimization. θopt is used for the external optimization routine, δopt for the internal one. These are both of type OptimOptions; see the OptimOptionsθ and OptimOptionsδ methods for elaboration. The memsave variable is set to false by default; turning it on will reduce memory consumption significantly, but will also slow down computation. The variable maxrepeats may disappear in the future.
There are two ways of computing choice probabilities: robust and fast, specified by passing :robust or :fast in probtype. Fast choice probabilities are the default for good reason.
Finally, specifying id allows one to add callbacks, e.g. user functions that are called on each inner and outer iteration. See the Extending Grumps portion of the documentation.
Grumps.OptimOptionsθ
— MethodOptimOptionsθ(;
f_tol = 1.0e-8,
g_tol = 1.0e-4,
x_tol = 1.0e-5,
iterations = 25,
show_trace = true,
store_trace = true,
extended_trace = true )
Creates and returns an OptimOptions optimization options variable for the outer optimization algorithm, including the function value tolerance, the gradient tolerance, the solution tolerance, the maximum number of iterations, whether to show the trace, whether to store the trace, and whether to keep the extended trace. See the Optim package for details.
The current version of Grumps will largely ignore the trace-related parameters.
Grumps.OptimOptionsδ
— MethodOptimOptionsδ( ;
f_tol = 1.0e-8,
g_tol = 1.0e-8,
x_tol = 1.0e-6,
iterations = 25,
show_trace = false,
store_trace = true,
extended_trace = false )
Creates and returns an OptimOptions optimization options variable for the inner optimization algorithm, including the function value tolerance, the gradient tolerance, the solution tolerance, the maximum number of iterations, whether to show the trace, whether to store the trace, and whether to keep the extended trace. See the Optim package for details.
The current version of Grumps will largely ignore the trace-related parameters.
Grumps.GrumpsThreads
— MethodGrumpsThreads(;
blas = 0,
markets = 0,
inner = 0
)
This sets the number of threads to be used subject to a number of caveats. blas refers to the number of BLAS threads, markets to the number of threads in loops over markets, and inner to the number of threads in inner loops. A value of zero forces the automatic selection of the number of threads.
Of these, inner is not currently used at all, market is only used in memsave mode, and blas is used. However, please note that the number of threads used by Grumps altogether is the number of threads passed in via the command line argument (i.e. via the -t switch), where that number does not include the number of BLAS threads set.
Data storage options
The default data storage options are sensible, but some space can be saved by tinkering with the settings. The only parameter that is worth changing in the first version of DataOptions
is σ2, which is the variance of ξ, the product level error term. This is of no relevance for two-stage estimators like unpenalized mle.
The second version of DataOptions
is more flexible. The first argument allows the user to specify a variance matrix for $ξ$ to be used in the construction of the product level moment component of the objective function. This choice is irrelevant in an exactly identified system. In an overidentified system it does not matter for consistency, asymptotic normality, conformance, or the convergence rate of the estimators provided that it is positive definite and fixed. It can affect efficiency. The second argument allows the user to specify how standard errors should be computed and also causes Grumps to compute an estimate of $V \xi$ that can be used as an input into a second stage.
Grumps.DataOptions
— MethodDataOptions(;
micromode = :Hog
macromode = :Ant
balance = :micro
σ2 = 1.0
id = :Grumps
)
Both this method and the one described below specify how Grumps should store its data and what it should store. This one is simpler but has less flexibility. The first three options are best set to their defaults, unless you know what it is you're doing. The σ2 option is the variance of ξ, i.e. the error variance in the product level moments. The id option is used to extend Grumps with other data constructions.
DataOptions(
VarξInput :: VarξInput{T},
VarξOutput :: VarξOutput = VarξDefaultOutput,
micromode :: Symbol = :Hog,
macromode :: Symbol = :Ant,
balance :: Symbol = :micro,
id :: Symbol = :Grumps
)
Both this method and the one described above specify how Grumps should store its data and what it should store. This one is both more complex and more flexible. The micromode, macromode, and balance arguments are best kept at their defaults, unless you know what it is you're doing. The id option is used to extend Grumps with other data constructions. VarξInput is the variance matrix to be used in the penalty term weight matrix construction. This should be a J by J matrix where J is the number of products across all markets. Acceptable types for VarξInput include UniformScaling{T} (e.g. 1.0 * I ) and AbstractMatrix{T} (sparse matrix is recommended to conserve space, but a dense matrix is allowed). VarξOutput is used to indicate what assumptions on the variance of ξ must be produced in the solution, which can subsequently be used as an input in a second stage if desirable; options are VarξHomoskedastic, VarξHeteroskedastic, VarξClustering, and VarξUser.
Grumps.VarξInput
— Typeconst VarξInput{T} = Union{ UniformScaling{T}, AbstractArray{T} }
Type used to characterize the assumption under which the weight matrix for the product level moments component of the objective function should be computed. This is irrelevant for consistency, conformance, or the convergence rate of the estimator but it can affect asymptotic efficiency.
Grumps.VarξHomoskedastic
— TypeVarξHomoskedastic()
Creates a variable of type VarξHomoskedastic. This is used to indicate that standard errors should be computed under the assumption of homoskedasticity. This choice does not affect efficiency. It also products an estimate of the matrix V(ξ) as part of the solution object, which can be used as an input into a possible second stage.
Grumps.VarξHeteroskedastic
— TypeVarξHeteroskedastic()
Creates a variable of type VarξHeteroskedastic. This is used to indicate that standard errors should be computed under the assumption of heteroskedasticity. This choice does not affect efficiency. It also products an estimate of the matrix V(ξ) as part of the solution object, which can be used as an input into a possible second stage.
Grumps.VarξClustering
— TypeVarξClustering( clusteron :: Symbol )
Creates a variable of type VarξClustering. This is used to indicate that standard errors should be computed under the assumption of clustering. This choice does not affect efficiency. It also products an estimate of the matrix V(ξ) as part of the solution object, which can be used as an input into a possible second stage. The argument is the variable one should cluster on, e.g. VarξClustering( :market ) suggests that Grumps should cluster on the variable contained in the column in the products spreadsheet with column heading market.
Grumps.VarξUser
— TypeVarξUser()
Allows the user to specify its own standard error computation procedure. Look at Grumps.Template
to see how this is implemented.
Standard error options
By default, Grumps computes standard errors for all coefficients. This option allows one to change that. For instance, standard errors may not be needed for all elements of $\delta$.
Grumps.StandardErrorOptions
— MethodStandardErrorOptions(; θ = true, δ = true, β = true )
Specifies which coefficients to create standard errors for. If you are looking for what type of standard errors to produce, look at DataOptions()
.
If you are looking to change the way standard errors are computed, look at DataOptions()
.
Estimator choice
Grumps can compute quite a few estimators and one can specify which estimator to use by passing the return value of a call to Estimator
to the optimization routine.
The easiest way to call Estimator
is by passing it a string that describes what it is that you want to do. For a description of these estimators, see Estimators.
Grumps.Estimator
— MethodEstimator( s :: String )
Creates and returns a GrumpsEstimator type. Grumps is reasonably good at figuring out what it is that you want, so e.g. Estimator( "maximum likelihood" ) gives you the unpenalized Grumps maximum likelihood estimator.
The estimators currently programmed include:
- the full CLER estimator
- a cheaper alternative to CLER that has the same limit distribution
- MDLE, i.e CLER without product level moments
- mixed logit with share constraints
- mixed logit estimator using micro data only
- GMM estimators of the same model (in progress: not recommended)
Grumps.Estimator
— MethodEstimator( s :: Symbol )
Creates and returns a GrumpsEstimator type.
This is one method of specifying the estimator used. However, it is unforgiving in that the exact symbol used internally must be passed, so the Estimator( s :: String ) method is usually a better choice.
Possible choices include:
:cler the full CLER estimator
:cheap a cheaper alternative to CLER that has the same limit distribution
:mdle MDLE, i.e CLER without product level moments
:shareconstraint mixed logit with share constraints
:mixedlogit mixed logit estimator using micro data only
:gmm GMM estimator of the same model (in progress: not recommended)
Grumps.Estimators
— MethodEstimators( elaborate = false )
Prints a list of available estimators. The argument indicates whether a lot of features should be printed or few.
Choice of integration method (integrators)
Grumps uses separate integration methods for the micro and macro components. This section will discuss the default choices, which are the only integrators implemented as part of the package. Users may implement their own integration routines, see adding an integrator.
For integrating the micro likelihood (over $\nu$), the default method is Hermitian quadrature which assumes $\nu$ is standard normally distributed. Users may select the number of nodes per dimension.
For integrating the macro likelihood (over $\nu$ and $z$), the default method is Monte Carlo integration. In this default, $\nu$ is assumed to be standard normally distributed. The distribution of $z$ can either be (1) assumed to be standard normally distributed or (2) simulated using draws from its distribution provided by the user. Option (2) should be used in applications where a sample of $z$ is available (e.g., consumer survey); the sample should be specified as the draws spreadsheet described in Spreadsheet formats.
One gets defaults if the integrator arguments are omitted in the call to Data()
. The default integrators use a small number of nodes / draws in the sense that they emphasize speed / storage over accuracy, unless specified otherwise as documented below.
Grumps.DefaultMicroIntegrator
— MethodDefaultMicroIntegrator( n :: Int, T :: Type = Float64; options = nothing )
Creates a basic quadrature Integrator using n nodes in each dimension. Type T can be omitted, in which case it is Float64. The options variable is ignored.
Grumps.DefaultMicroIntegrator
— MethodDefaultMicroIntegrator( T :: Type; options = nothing )
Creates a basic quadrature Integrator using 11 nodes in each dimension. Type T can be omitted, in which case it is Float64. The options variable is ignored.
Grumps.DefaultMacroIntegrator
— MethodDefaultMacroIntegrator( n :: Int, T :: Type; options :: Union{Vec{Symbol}, Nothing} = nothing )
Creates a basic Monte Carlo Integrator using n draws. Type T can be omitted, in which case it is Float64. The optional options argument can be used to indicate two possible changes from the default, namely :randomize can be used to require randomization and :replacement to indicate randomization with replacement. The default for both is false. Note that options is either nothing or a vector of symbols. A further use of options is to specify a column heading containing weight; this symbol should correspond to the desired column heading in the draws spreadsheet.
Grumps.DefaultMacroIntegrator
— MethodDefaultMacroIntegrator( T )
Creates a basic Monte Carlo Integrator using 10 000 draws. This is less than recommended, so use the other method to set a number of your choosing. Type T can be omitted, in which case it is Float64. The optional options argument can be used to indicate two possible changes from the default, namely :randomize can be used to require randomization and :replacement to indicate randomization with replacement. Note that options is either nothing or a vector of symbols. The defaults for both is false. A further use of options is to specify a column heading containing weight; this symbol should correspond to the desired column heading in the draws spreadsheet.
Unless specified otherwise, the default macro integrator uses Monte Carlo integration with $R = 10,000$ draws unless otherwise specified. If one does not specify randomization then the default macro integrator simply uses the first $R$ lines of draws for each market for demographics ($z$ draws) and combines them with $R$ draws from the distribution of the random coefficients ($\nu$ draws), both of which are then interacted with the product level regressors ($x$ variables). If the spreadsheet does not contain enough rows corresponding to a market then the program will cycle and throw a warning. With randomization with replacement, $R$ numbers are drawn from the draws spreadsheet regardless of the number of lines in the spreadsheet. Without replacement, the same occurs and if the spreadsheet does not contain enough lines corresponding to the market, all lines are added and then the procedure is repeated. In other words, there is replacement by necessity. Again, a warning will be displayed. With randomization, the random numbers are drawn separately for each market.
The remaining integration methods are only germane for GMM, which is in progress.
Grumps.MSMMicroIntegrator
— MethodMSMMicroIntegrator( n :: Int, T = F64; options = nothing )
Creates a Monte Carlo integrator type for micro integration with GMM with smart moments. The optional type can be omitted. The options variable is ignored.
Grumps.MSMMicroIntegrator
— MethodMSMMicroIntegrator( T = F64; options = nothing )
Creates a Monte Carlo integrator type for micro integration with GMM with smart moments with 10 MC draws (per consumer). The type variable is optional and can be omitted. The options variable is ignored.
Data object creation
The data stored in spreadsheets or other objects have to be converted into a form that Grumps understands. The call to Data
achieves that. It takes as inputs the various choices made by the user and then creates an appropriate data object that is subsequently passed to the optimization call.
Grumps.Data
— MethodData(
e :: GrumpsEstimator,
ss :: Sources,
v :: Variables,
microintegrator :: MicroIntegrator = DefaultMicroIntegrator(),
microintegrator :: MacroIntegrator = DefaultMacroIntegrator(),
T :: Type = F64,
options :: DataOptions = GrumpsDataOptions(),
replicable :: Bool = false
)
Takes user inputs and converts them into an object that Grumps can understand. This is synonymous with GrumpsData(...).
Data takes the following arguments, of which the first three are mandatory:
- e: estimator; see Estimator choice
- ss: data sources; see Data entry
- v: variables to be used; see Data entry
- o: optimization options to be used
- microintegrator: micro integrator see Choice of integration method (integrators)
- macrointegrator: macro integrator see Choice of integration method (integrators)
- T: floating point type; not heavily tested
- u: not yet implemented
- options: data options to be used, see Data storage options
- replicable: whether results must be replicable (slows down speed of data creation if set to true)
If you value replicability, set replicable=true
. What it does is ensure that the same random numbers are fed into the integration routine. This means that you will get exactly the same results if you run the program multiple times on the same computer with the same Grumps and Julia versions and the same versions of the included packages loaded and the same settings. Achieving identical numbers beyond that is unrealistic. However, differences should typically be small.
The downside of enforcing replicability is that it slows down data object generation since the data objects are then not generated in parallel. Optimization itself will still be done in parallel however.
Algorithm call
Once all data structures have been put together, one can call the algorithm. This is straightforward.
Grumps.grumps!
— Methodgrumps!(
e :: Estimator,
d :: Data{T},
o :: OptimizationOptions = OptimizationOptions(),
θstart :: StartingVector{T} = nothing,
seo :: StandardErrorOptions = StandardErrorOptions()
)
Conducts the optimization. You typically just want to set θstart to nothing, i.e. have a starting vector picked automatically.
Retrieving results
As noted above, Grumps will return its results in a variable of type GrumpsSolution
that can be queried or saved as follows. You can also simply call one of the print
or related functions on any of these objects.
Finally, you can call any of minimum
, iterations
, iteration_limit_reached
, converged
, f_converged
, g_converged
, x_converged
, f_calls
, g_calls
, h_calls
, f_trace
, g_norm_trace
, x_trace
on a GrumpsSolution
object in the same way that you would query the return value in the Optim package, albeit that they are not in the namespace by default. E.g., if sol
is a GrumpsSolution
object, use Grumps.converged(sol)
instead of converged(sol)
.
Grumps.getθ
— Methodgetθ( sol :: GrumpsSolution )
Returns a vector of GrumpsEstimate types for θ that can be queried for results. See getcoef, getstde, gettstat, and getname.
Grumps.getδ
— Methodgetδ( sol :: GrumpsSolution )
Returns a vector of GrumpsEstimate types for δ that can be queried for results. See getcoef, getstde, gettstat, and getname.
Grumps.getβ
— Methodgetβ( sol :: GrumpsSolution )
Returns a vector of GrumpsEstimate types for β that can be queried for results. See getcoef, getstde, gettstat, and getname.
Grumps.getcoef
— Methodgetcoef( e :: GrumpsEstimate )
Returns the estimated coefficient value.
Grumps.getstde
— Methodgetstde( e :: GrumpsEstimate )
Returns the standard error.
Grumps.gettstat
— Methodgettstat( e :: GrumpsEstimate )
Returns the t statistic.
Grumps.getname
— Methodgetname( e :: GrumpsEstimate )
Returns the variable name.
Grumps.getθcoef
— Methodgetθcoef( sol :: GrumpsSolution )
Returns a vector of θ coefficients
Grumps.getδcoef
— Methodgetδcoef( sol :: GrumpsSolution )
Returns a vector of δ coefficients
Grumps.getβcoef
— Methodgetβcoef( sol :: GrumpsSolution )
Returns a vector of β coefficients
Grumps.Save
— MethodSave( fn, mt, sol :: GrumpsSolution; keywords... )
Saves the solution stored in sol
to a file with filename fn
which has mime type mt
.
There are several keywords that are described below, some of which will be ignored for some mime types. Allowed mime types are text/plain
, text/csv
, and text/tex
.
Keyword | Description | Default |
---|---|---|
colsep | column separator | "," |
adorned | make output pretty? | true |
printθ | print θ results? | true |
printβ | print β results? | true |
printδ | print δ results? | false |
printconvergence | convergence stats? | true |
Grumps.Save
— MethodSave( fn, sol :: GrumpsSolution; keywords... )
The same as the form of Save
with prespecified mime type except that the mime type is now inferred from the file extension. The keywords also have the same meaning, namely...
There are several keywords that are described below, some of which will be ignored for some mime types. Allowed mime types are text/plain
, text/csv
, and text/tex
.
Keyword | Description | Default |
---|---|---|
colsep | column separator | "," |
adorned | make output pretty? | true |
printθ | print θ results? | true |
printβ | print β results? | true |
printδ | print δ results? | false |
printconvergence | convergence stats? | true |
Base.show
— Methodshow( io :: IO, e :: GrumpsEstimate{T}, s :: String = ""; keywords...)
Show a GrumpsEstimate
object on io
; the argument s
indicates which parameter family (θ,β,δ) the estimate belongs to. The optional keywords are described in the table below.
Keyword | Description | Default |
---|---|---|
adorned | make output pretty? | true |
printstde | print standard errors? | true |
printtstat | print t statistics? | true |
Base.show
— Methodshow( io :: IO, est :: Vector{ GrumpsEstimate{T} }, s :: String = ""; keywords... )
Shows a vector of estimates on io
using the string s
(typically one of θ,β,δ). The command takes the following optional keywords.
Keyword | Description | Default |
---|---|---|
adorned | make output pretty? | true |
printstde | print standard errors? | true |
printtstat | print t statistics? | true |
header | descriptive header? | false |
Base.show
— Methodshow( io :: IO, convergence :: GrumpsConvergence{T}; keywords...)
Shows the contents of convergence
, where the flags indicated what should be printed and how, as indicated in the following table.
Keyword | Description | Default |
---|---|---|
adorned | make output pretty? | true |
header | descriptive header? | false |
Base.show
— Methodshow( io :: IO, sol :: GrumpsSolution{T}; keywords... )
Shows the contents of sol
, where the keywords indicate what should be printed and how, as described in the table below.
Keyword | Description | Default |
---|---|---|
adorned | make output pretty? | true |
printθ | print θ results? | true |
printβ | print β results? | true |
printδ | print δ results? | false |
printconvergence | convergence stats? | true |
Base.show
— Methodshow( io :: IO, mt :: MIME{Symbol("text/tex")}, sol :: GrumpsSolution; keywords... )
This is the same as Save()
except that the contents are spit out on io (which could be stdout
or an already opened file).
Base.show
— Methodshow( io :: IO, mt :: MIME{Symbol("text/csv")}, sol :: GrumpsSolution; keywords... )
This is the same as Save()
except that the contents are spit out on io (which could be stdout
or an already opened file).
To save estimation results directly to a LaTeX tabular, just use a .tex
extension in the filename. For instance, write Save( "results.tex", sol )
if your solution is in the variable sol
.
To save the terminal output to html, one can use Aha, the Ansi HTML Adapter, which is a small program (unrelated to Julia) that converts terminal output to html. The way that would work on Linux and Mac (after successful installation) if one ran Grumps directly from the command line is to append | aha > myrun.html
, e.g. julia -t auto myprogram.jl | aha > myrun.html
.