Computed theoretical power for N=100 and N=200 scenarios
This commit is contained in:
171
Modules/ado/personal/b/backrasch.ado
Normal file
171
Modules/ado/personal/b/backrasch.ado
Normal file
@ -0,0 +1,171 @@
|
||||
*! version 3 11june2014
|
||||
************************************************************************************************************
|
||||
* Backrasch : Backward procedure under a Rasch model
|
||||
*
|
||||
* Historic
|
||||
* Version 1 (2004-02-13) : Jean-Benoit Hardouin
|
||||
* Version 2 (2005-05-23) : Jean-Benoit Hardouin
|
||||
* Version 3 (2014-06-11) : Jean-Benoit Hardouin /*id for raschtest*/
|
||||
*
|
||||
* Needed modules :
|
||||
* raschtestv7 version 7.2.1 (http://freeirt.free.fr)
|
||||
* gammasym version 2.1 (http://freeirt.free.fr)
|
||||
* gausshermite version 1 (http://freeirt.free.fr)
|
||||
* geekel2d version 4.1 (http://freeirt.free.fr)
|
||||
* ghquadm (findit ghquadm)
|
||||
* gllamm version 2.3.10 (ssc describe gllamm)
|
||||
* gllapred version 2.3.2 (ssc describe gllapred)
|
||||
* elapse (ssc describe elapse)
|
||||
*
|
||||
* Jean-benoit Hardouin, Regional Health Observatory of Orl<72>ans - France
|
||||
* jean-benoit.hardouin@orscentre.org
|
||||
*
|
||||
* News about this program : http://anaqol.free.fr
|
||||
* FreeIRT Project : http://freeirt.free.fr
|
||||
*
|
||||
* Copyright 2004-2005, 2014 Jean-Benoit Hardouin
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
************************************************************************************************************
|
||||
|
||||
program define backrasch , rclass
|
||||
version 8.0
|
||||
syntax varlist(min=3 numeric) , [p(real 0.05) Method(string) Test(string) NBSCales(integer 1) nodetail noAUTOGroup]
|
||||
local nbitems : word count `varlist'
|
||||
tokenize `varlist'
|
||||
preserve
|
||||
|
||||
|
||||
tempfile saveraschtest
|
||||
qui save `saveraschtest'
|
||||
|
||||
local autogroup2
|
||||
if "`autogroup'"=="" {
|
||||
local autogroup2 autogroup
|
||||
}
|
||||
if "`method'"=="" {
|
||||
local method cml
|
||||
}
|
||||
if "`test'"=="" {
|
||||
local test R
|
||||
}
|
||||
|
||||
tempname select
|
||||
matrix `select'=J(1,`nbitems',0)
|
||||
local dim=1
|
||||
local less3items=0
|
||||
|
||||
while `dim'<=`nbscales'&`less3items'!=1 {
|
||||
di
|
||||
di in green _col(25) "subscale : " in yellow `dim'
|
||||
di in green _col(25) "{hline 12}"
|
||||
local nobaditem=0
|
||||
while `nobaditem'!=1 {
|
||||
local varlistscale
|
||||
local nbitemsscale=0
|
||||
forvalues i=1/`nbitems' {
|
||||
if `select'[1,`i']==0 {
|
||||
local nbitemsscale=`nbitemsscale'+1
|
||||
local ssitem`nbitemsscale'=`i'
|
||||
local varlistscale `varlistscale' ``i''
|
||||
}
|
||||
}
|
||||
|
||||
if `nbitemsscale'<3 {
|
||||
if "`detail'"=="" {
|
||||
di in green "The " in yellow "`dim'th " in green "sub-scale can not be created, because there is less than three items remaining"
|
||||
}
|
||||
local `less3items'=1
|
||||
local dim=`dim'-1
|
||||
continue, break
|
||||
}
|
||||
else {
|
||||
tempvar tmp
|
||||
capture gen `tmp'=_n
|
||||
qui raschtestv7 `varlistscale',m(`method') t(`test') `autogroup2' id(`tmp')
|
||||
tempname itemFit
|
||||
matrix `itemFit'=r(itemFit)
|
||||
local minp=`p'
|
||||
local deleteitem
|
||||
local nobaditem=1
|
||||
forvalues i=1/`nbitemsscale' {
|
||||
if `itemFit'[`i',3]<`minp' {
|
||||
local minp=`itemFit'[`i',3]
|
||||
local deleitem=`i'
|
||||
local rowdeleteitem=`ssitem`i''
|
||||
local nobaditem=0
|
||||
}
|
||||
}
|
||||
if `nobaditem'==1 {
|
||||
if "`detail'"=="" {
|
||||
di in green "No more item to remove of the scale " in yellow "`dim'"
|
||||
}
|
||||
continue, break
|
||||
}
|
||||
else {
|
||||
if "`detail'"=="" {
|
||||
di in green "The item " in yellow "``rowdeleteitem'' " in green "is removed of the scale " in yellow "`dim'" in green " (p=" in yellow %6.4f `minp' in green ")"
|
||||
}
|
||||
matrix `select'[1,`rowdeleteitem']=-1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if `nbitemsscale'>=3 {
|
||||
forvalues i=1/`nbitems' {
|
||||
if `select'[1,`i']==0 {
|
||||
matrix `select'[1,`i']==`dim'
|
||||
}
|
||||
if `select'[1,`i']==-1 {
|
||||
matrix `select'[1,`i']==0
|
||||
}
|
||||
}
|
||||
local scale`dim'
|
||||
forvalues i=1/`nbitems' {
|
||||
if `select'[1,`i']==`dim' {
|
||||
local scale`dim' "`scale`dim'' ``i''"
|
||||
}
|
||||
}
|
||||
if "`scale`dim''"!="" {
|
||||
di
|
||||
di in green _col(4) "Number of selected items : " in yellow "`nbitemsscale'"
|
||||
tempvar tmp2
|
||||
capture gen `tmp2'=_n
|
||||
raschtestv7 `scale`dim'',m(`method') t(`test') `autogroup2' id(`tmp2')
|
||||
di
|
||||
di _dup(70) "-"
|
||||
}
|
||||
|
||||
|
||||
local dim=`dim'+1
|
||||
}
|
||||
if `nbitemsscale'<3{
|
||||
forvalues i=1/`nbitems' {
|
||||
if `select'[1,`i']==-1 {
|
||||
matrix `select'[1,`i']==0
|
||||
}
|
||||
}
|
||||
continue, break
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
matrix colnames `select'=`varlist'
|
||||
matrix rownames `select'=scale
|
||||
|
||||
return matrix selection `select'
|
||||
end
|
||||
|
54
Modules/ado/personal/b/backrasch.hlp
Normal file
54
Modules/ado/personal/b/backrasch.hlp
Normal file
@ -0,0 +1,54 @@
|
||||
{smcl}
|
||||
{* 23may2005}{...}
|
||||
{hline}
|
||||
help for {hi:backrasch}
|
||||
{hline}
|
||||
|
||||
{title:Backward procedure on a Rasch model}
|
||||
|
||||
{p 8 14 2}{cmd:backrasch} {it:varlist} {cmd:,} [{cmdab:m:ethod}({it:keyword})
|
||||
{cmdab:t:est}({it:keyword}) {cmdab:nodetail}
|
||||
{cmdab:p}({it:#.###}) {cmdab:nbsc:ales}({it:#})
|
||||
{cmdab:noautog:roup}]
|
||||
|
||||
{title:Description}
|
||||
|
||||
{p 4 8 2}{cmd:backward} realizes a Backward procedure on a Rasch model: the
|
||||
items are removed one per one if they have a bad fit to the Rasch model. The
|
||||
fit of the items is valuated by a first-order statistics (test R1c, R1m or Q1)
|
||||
It is possible to build several sub-scales of items, the second sub-scale is
|
||||
build with the items unselected in the first sub-scales, the third one
|
||||
with the items unselected in the two first sub-scales, and so on... By default,
|
||||
the parameters of the Rasch model are estimated by conditional maximum
|
||||
likelihood (CML), but it is possible to estimate them by marginal maximum
|
||||
likelihood (MML) or generalized estimating equations (GEE).
|
||||
|
||||
{title:Options}
|
||||
|
||||
{p 4 8 2}{cmd:method}({it:cml/mml/gee}) defines the method of estimation of the difficulty parameters among conditional maximum likelihood (cml - by default), marginal maximum likelihood (mml) or generalized estimating equations (gee).
|
||||
|
||||
{p 4 8 2}{cmd:test}({it:R/Q}) defines the first order statistics to use between R-type test (R1c or R1m - by default) or the Q1 test of Van den Wollenberg.
|
||||
|
||||
{p 4 8 2}{cmd:nodetail} does not display the description of the algorithm.
|
||||
|
||||
{p 4 8 2}{cmd:p}({it:#.###}) defines the level of signification who define a significantly bad fitted item (0.05 by default).
|
||||
|
||||
{p 4 8 2}{cmd:nbscales}({it:#}) defines the maximal number of sub-scales to build. By default, the program builds only one sub-scale.
|
||||
|
||||
{p 4 8 2}{cmd:noautograoup} forces the program to compute the first order fit statistics with the groups defined by the value of the score. by default, the scores are grouped to obtained groups of 30 individuals or more.
|
||||
|
||||
{title:Examples}
|
||||
|
||||
{p 4 8 2}{cmd:. backrasch item1 item2 item3 item4} /*estimation by CML, test R1c, only one scale is built*/
|
||||
|
||||
{p 4 8 2}{cmd:. backrasch item1 item2 item3 item4 , p(0.2) method(mml) nodetail} /*estimation by MML, test R1m, only one scale*/
|
||||
|
||||
{p 4 8 2}{cmd:. backrasch item1 item2 item3 item4 , p(0.1) nbsc(5) noautog} /*CLM estimation, R1c tests, 5 scales will be build*/
|
||||
|
||||
{title:Author}
|
||||
|
||||
{p 4 8 2}Jean-Benoit Hardouin, Regional Health Observatory (ORS) - 1, rue Porte
|
||||
Madeleine - BP 2439 - 45032 Orleans Cedex 1 - France. You can contact the author at
|
||||
{browse "mailto:jean-benoit.hardouin@orscentre.org":jean-benoit.hardouin@orscentre.org}
|
||||
and visit the websites {browse "http://anaqol.free.fr":AnaQol} and
|
||||
{browse "http://freeirt.free.fr":FreeIRT}
|
74
Modules/ado/personal/b/biplotvlab.ado
Normal file
74
Modules/ado/personal/b/biplotvlab.ado
Normal file
@ -0,0 +1,74 @@
|
||||
*! version 1.0.1 30sep2005
|
||||
*! The first version of this module has been wroten by Ken Higbee (StataCorp)
|
||||
*! Improvements by Jean-Benoit Hardouin
|
||||
|
||||
program biplotvlab
|
||||
|
||||
version 9
|
||||
|
||||
syntax varlist(numeric min=2) [if] [in] [, LABdes(string) stretch(int 1) *]
|
||||
|
||||
// run biplot quietly (and nograph) so we can get r(V)
|
||||
qui biplot `varlist' `if' `in' , `options' nograph
|
||||
tempname V
|
||||
mat `V' = r(V)
|
||||
local nbvar:word count `varlist'
|
||||
tokenize `varlist'
|
||||
|
||||
// build the -text()- option
|
||||
local topt "text("
|
||||
local i 0
|
||||
local miny=`V'[1,2]
|
||||
local maxy=`V'[1,2]
|
||||
local minx=`V'[1,1]
|
||||
local maxx=`V'[1,1]
|
||||
forvalues i=1/`nbvar' {
|
||||
local miny=min(`V'[`i',2],`miny')
|
||||
local maxy=max(`V'[`i',2],`maxy')
|
||||
local minx=min(`V'[`i',1],`minx')
|
||||
local maxx=max(`V'[`i',1],`maxx')
|
||||
}
|
||||
if `maxx'*`minx'>0 {
|
||||
local coefx=max(abs(`maxx'),abs(`minx'))
|
||||
local coefx=`coefx'/20
|
||||
}
|
||||
else {
|
||||
local coefx=abs(`maxx'-`minx')/20
|
||||
}
|
||||
if `maxx'*`minx'>0 {
|
||||
local coefy=max(abs(`maxy'),abs(`miny'))
|
||||
local coefy=`coefy'/20
|
||||
}
|
||||
else {
|
||||
local coefy=abs(`maxy'-`miny')/20
|
||||
}
|
||||
forvalues i=1/`nbvar' {
|
||||
// y value
|
||||
if `V'[`i',2]>0 {
|
||||
local topt `"`topt' `= (`V'[`i',2]+`coefy')*`stretch''"'
|
||||
}
|
||||
else {
|
||||
local topt `"`topt' `= (`V'[`i',2]-`coefy')*`stretch''"'
|
||||
}
|
||||
// x value
|
||||
if `V'[`i',1]<0 {
|
||||
local topt `"`topt' `= (`V'[`i',1]-`coefx')*`stretch''"'
|
||||
}
|
||||
else {
|
||||
local topt `"`topt' `= (`V'[`i',1]+`coefx')*`stretch''"'
|
||||
}
|
||||
// variable label
|
||||
local lab: var label ``i''
|
||||
if "`lab'"=="" {
|
||||
local lab ``i''
|
||||
}
|
||||
local topt `"`topt' `"`lab'"' "'
|
||||
}
|
||||
if "`labdes'"=="" {
|
||||
local labdes size(vsmall)
|
||||
}
|
||||
local topt `"`topt',`labdes')"'
|
||||
|
||||
// call with -colopts(nolabel)- and -text()- just built
|
||||
biplot `varlist' `if' `in', `options' colopts(nolabel) `topt' stretch(`stretch')
|
||||
end
|
38
Modules/ado/personal/b/biplotvlab.hlp
Normal file
38
Modules/ado/personal/b/biplotvlab.hlp
Normal file
@ -0,0 +1,38 @@
|
||||
{smcl}
|
||||
{* 30sept2005}{...}
|
||||
{hline}
|
||||
help for {hi:biplotvlab}{right:Jean-benoit Hardouin}
|
||||
{hline}
|
||||
|
||||
{title:Biplot with variable labels}
|
||||
|
||||
{p 8 14 2}{cmd:biplotvlab} {it:varlist} [{cmd:,} {cmdab:lab:des}({help textbox_options}) {help biplot:biplot_options})
|
||||
|
||||
{title:Description}
|
||||
|
||||
{p 4 8 2}{cmd:biplotvlab} allows displaying on a biplot graph the labels of the
|
||||
variables instead of the names of the variables. If none label is defined for one
|
||||
or several variables, the names of these variables are displayed instead.
|
||||
{cmd:biplotvlab} replaces the official {cmd:biplot} command.
|
||||
|
||||
{title:Options}
|
||||
|
||||
{p 4 8 2}{cmd:labdes} defines the options to apply to the labels (color, size...).
|
||||
|
||||
{title:Examples}
|
||||
|
||||
{p 4 8 2}{cmd:. biplotvlab turn trunk mpg,norow}
|
||||
|
||||
{p 4 8 2}{cmd:. biplotvlab turn trunk mpg,labdes(size(vsmall) color(blue))}
|
||||
|
||||
{p 4 8 2}{cmd:. biplotvlab turn trunk mpg, stretch(12)}
|
||||
|
||||
{title:Authors}
|
||||
|
||||
{p 4 8 2}Ken Higbee (StataCorp) has wroten the first version of this module.
|
||||
|
||||
{p 4 8 2}Improvements by Jean-Benoit Hardouin, Regional Health Observatory (ORS) - 1, rue Porte
|
||||
Madeleine - BP 2439 - 45032 Orleans Cedex 1 - France. You can contact the author at
|
||||
{browse "mailto:jean-benoit.hardouin@orscentre.org":jean-benoit.hardouin@orscentre.org}
|
||||
and visit the websites {browse "http://anaqol.free.fr":AnaQol} and
|
||||
{browse "http://freeirt.free.fr":FreeIRT}
|
Reference in New Issue
Block a user