Skip to content

Instantly share code, notes, and snippets.

View 13bzhang's full-sized avatar

Baobao Zhang 13bzhang

View GitHub Profile
13bzhang / qualtrics_text_textbox.js
Created April 8, 2016 01:51
Qualtrics text before and after textbox
/*Place Your Javascript Below This Line*/
var inputs = $(this.getQuestionContainer()).select('input[type="text"]');
for (var i = 0; i < inputs.length; i++) {
var input = inputs[i];
$(input).insert({before: 'In '});
$(input).insert({after: ' years'});
13bzhang / predict_lm.R
Last active February 11, 2020 00:49
Prediction function for linear regression with robust/cluster robust standard errors
predict.lm <- function(mod, predict.df, rob, cluster = NULL){
##Written by Joshua Gubler ~
##Last updated on 26 June 2014
##Updated by Baobao Zhang
##This provides an option for robust (including cluster robust) or non-robust standard errors
##Note: when estimating a polynomial, you must create the quadratic/cubic as a separate variable first!! This is also the best procedure when estimating logged effects. However, when estimating interaction effects, there is no need to create a separate interaction term.
##Also note, that for this function to work well, you must input factor variables with more than two levels individually (as indiviual dummies).
if(missing(predict.df)){ predict1.df <- mod$model }
13bzhang / qualtrics_autofill.html
Last active June 25, 2017 19:03
Qualtrics autofill
<script src="//"></script>
<link href="//" rel="stylesheet" />
<script src="//"></script>