-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhlm_r2.slim
110 lines (88 loc) · 4.85 KB
/
hlm_r2.slim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/ TODO: Wake Python API up in proper manner
div id='r2-home'
markdown:
## HLM / multilevel Pseudo R-squared
### Inputs
Export all your variables into a csv file. The first row has to be the variable names - without spaces within variable names. To minimize problems, files should be ASCII and should not contain missing values.
input type='file' class='data-hlm-r2' id='file_r2' name='file_r2' onchange='getVariables()' tabindex=7 required='true' disabled='true'
a href="#form6" onclick="toggler(6)" title="Click for formula"
| Optimization Method:
|  
select id='method-r2' tabindex=7 required='true'
option value=0 Nelder-Mead
option value=1 Powell
option value=2 cg
option value=3 selected='selected' bfgs
br
input id='channel-r2' class='data-hlm-r2' hidden='true' value="#{SecureRandom.hex}"
br
div id='outcome-table'
br
button type='submit' id='hlm_r2_btn' name='hlm_r2_btn' tabindex=7 onClick='hlmR2BtnClick()' disabled='true' Calculate
div
p class='result-hlm-r2' id='hlm_r2_inputs' name=':inputs'
p class='result-hlm-r2' id='hlm_r2_warning' name=':warning'
div id="form6"
markdown:
### Results
table cellpadding='10' align='center'
tr align='right'
td
a href="#form6" onclick="toggler(6)" title="Click for formula"
| Marginal R-squared:
|  
input type='number' class='result-hlm-r2' name=':rsq_marg' readonly='true' tabindex=-1
td
a href="#form6" onclick="toggler(6)" title="Click for formula"
| Conditional R-squared:
|  
input type='number' class='result-hlm-r2' name=':rsq_cond' readonly='true' tabindex=-1
tr align='right'
td
| Variance between:
input type='number' class='result-hlm-r2' name=':vara_f' readonly='true' tabindex=-1
td
| Variance within:
input type='number' class='result-hlm-r2' name=':varw_f' readonly='true' tabindex=-1
tr align='right'
td
a href="#form6" onclick="toggler(6)" title="Click for formula"
| Average random effect:
|  
input type='number' class='result-hlm-r2' name=':k' readonly='true' tabindex=-1
td
a href="#form6" onclick="toggler(6)" title="Click for formula"
| Residual ICC:
|  
input type='number' class='result-hlm-r2' name=':icc_f' readonly='true' tabindex=-1
tr align='right'
td
| Clusters analyzed:
input type='number' class='result-hlm-r2' name=':n' readonly='true' tabindex=-1
td
| Model converged?:
input type='text' class='result-hlm-r2' name=':convergence_f' readonly='true' tabindex=-1
tr
td align='center' colspan=2
button type='reset' tabindex=7 onClick="clearInputs('result-hlm-r2')" Clear
div id='text-area-6' style='display:none'
markdown:
#### Brief background
p align='left'
| These are <em>pseudo-R-squared's</em> as they attempt to recreate the properties of R-squared from OLS. These measures achieve those properties to varying degrees.<br>
| The <em>marginal R-squared</em> attempts to capture the variance explained by the fixed effects in the model, and the <em>conditional R-squared</em> attempts to capture the variance explained by both the fixed effects and random effects.<br>
markdown:
#### Formula



where R^2_m, R^2_c_ are the marginal and conditional R-squared's respectively,
_var_re_ is the average of the random effects variance, _sigma_squared_ is the variance within clusters,
and _var_fixed_ is the variance explained by the fixed effects in the model.
See [here](https://github.com/stonegold546/cohens_d_calculators/blob/master/README.md#hierarchical-linear-modeling--multilevel-modeling--mixed-effects-modeling){:target="_blank"} for additional details.
p name=':warning'
| Check the results for convergence. If they do not converge, try another optimization method from the drop down menu above.
markdown:
___
script src='hlm_r2.js'