Skip to content

Commit

Permalink
Build in V12
Browse files Browse the repository at this point in the history
  • Loading branch information
fmg-jluchman committed Feb 19, 2021
1 parent fdfb365 commit 2ed3244
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 18 deletions.
29 changes: 19 additions & 10 deletions mixdom.ado
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
*! mixdom version 1.1 3/11/2015 Joseph N. Luchman
*! mixdom version 2.0 2/15/2021 Joseph N. Luchman

version 12.1
version 12

program define mixdom, eclass

syntax varlist(min = 2 fv ts) [pw fw] if, id(varlist max = 1 min = 1) [REopt(string) XTMopt(string) ///
noConstant]
Mopt(string) noConstant]

if strlen("`xtmopt'") & strlen("`mopt'") {
display as err "{cmd:xtmopt} both {cmd:mopt} cannot be used together"
exit 198
}

if c(stata_version) >= 13 local reg "mixed"
else local reg "xtmixed"

if strlen("`xtmopt'") local mopt "`xtmopt'"

tempname estmat r2w r2b base_e base_u mean_h

Expand All @@ -19,7 +29,7 @@ foreach temp in base_e base_u mean_h {

}

xtmixed `dv' `ivs' [`weight'`exp'] `if' , `constant' || `id':, `reopt' `xtmopt' nostderr
`reg' `dv' `ivs' [`weight'`exp'] `if' , `constant' || `id':, `reopt' `mopt' nostderr

matrix `estmat' = e(b)

Expand Down Expand Up @@ -49,7 +59,7 @@ di `r2b'

if missing(`base_e') | missing(`base_u') {

xtmixed `dv' [`weight'`exp'] `if' , `constant' || `id':, `reopt' `xtmopt' nostderr
`reg' `dv' [`weight'`exp'] `if' , `constant' || `id':, `reopt' `mopt' nostderr

matrix `estmat' = e(b)

Expand Down Expand Up @@ -82,14 +92,13 @@ end
/* programming notes and history
- mixdom version 1.0 - date - Jan 15, 2014
Basic version
-----
- mixdom version 1.1 - date - Mar 11, 2015
//notable changes\\
- added version statement (12.1)
- time series operators allowed
- removed scalars persisting after estimation
-----
- mixdom version 2.0.1 - date - Feb 15, 2021
- -xtmopt()- depreciated in favor of -mopt()-
-- v12...
18 changes: 10 additions & 8 deletions mixdom.sthlp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{smcl}
{* *! version 1.1 March 11 2015 J. N. Luchman}{...}
{* *! version 2.0.0 Feb 15, 2021 J. N. Luchman}{...}
{cmd:help mixdom}
{hline}{...}

Expand All @@ -12,15 +12,15 @@ Wrapper program for {cmd:domin} to conduct linear mixed effects regression domin

{phang}
{cmd:mixdom} {it:depvar} {it:indepvars} {it:{help if}} {weight} {cmd:,}
{opt id(idvar)} [{opt {ul on}re{ul off}opt(re_options)} {opt {ul on}xtm{ul off}opt(xtmixed_options)} {opt {ul on}noc{ul off}onstant}]
{opt id(idvar)} [{opt {ul on}re{ul off}opt(re_options)} {opt {ul on}m{ul off}opt(mixed_options)} {opt {ul on}noc{ul off}onstant}]

{phang}{cmd:pweight}s and {cmd:fweight}s are allowed (see help {help weights:weights}). {help fvvarlist:Factor} and
{help tsvarlist:time series variables} are allowed.

{title:Description}

{pstd}
{cmd:mixdom} sets the data up in a way to allow for the dominance analysis of a linear mixed effects regression by utilizing {help xtmixed}.
{cmd:mixdom} sets the data up in a way to allow for the dominance analysis of a linear mixed effects regression by utilizing {help mixed}.
The method outlined here follows that for the within- and between-cluster Snijders and Bosker (1994) R2 metric described by Luo and Azen (2013).

{pstd}
Expand All @@ -35,14 +35,16 @@ Negative R2 values indicate model misspecification.
{title:Options}

{phang}{opt id()} specifies the variable on which clustering occurs and that will appear after the random effects specification (i.e., ||) in the
{cmd:xtmixed} syntax.
{cmd:mixed} syntax.

{phang}{opt remopt()} passes options to {cmd: xtmixed} specific to the random intercept effect (i.e., {opt pweight()} the user would
{phang}{opt remopt()} passes options to {cmd: mixed} specific to the random intercept effect (i.e., {opt pweight()} the user would
like to utilize during estimation.

{phang}{opt xtmopt()} passes options to {cmd:xtmixed} that the user would like to utilize during estimation.
{phang}{opt mopt()} passes options to {cmd:mixed} that the user would like to utilize during estimation.
This option was named {opt xtmopt()} in {cmd:mixdom} versions previous to 2.0. {opt xtmopt()} still works in
{cmd:mixdom} 2.0 but cannot be used with {opt mopt()}.

{phang}{opt noconstant} does not estimate an average fixed-effect constant (see option {opt noconstant} of {help xtmixed}).
{phang}{opt noconstant} does not estimate an average fixed-effect constant (see option {opt noconstant} of {help mixed}).

{title:Saved results}

Expand All @@ -69,5 +71,5 @@ like to utilize during estimation.
{title:Also see}

{psee}
{manhelp xtmixed R}.
{manhelp mixed R}.
{p_end}

0 comments on commit 2ed3244

Please sign in to comment.