Skip to content

Instantly share code, notes, and snippets.

Avatar

Baobao Zhang 13bzhang

View GitHub Profile
View qualtrics_autofill.html
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<link href="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css" rel="stylesheet" />
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
@13bzhang
13bzhang / predict_lm.R
Last active Feb 11, 2020
Prediction function for linear regression with robust/cluster robust standard errors
View predict_lm.R
predict.lm <- function(mod, predict.df, rob, cluster = NULL){
##Written by Joshua Gubler ~ http://scholar.byu.edu/jgubler
##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
13bzhang / qualtrics_text_textbox.js
Created Apr 8, 2016
Qualtrics text before and after textbox
View qualtrics_text_textbox.js
Qualtrics.SurveyEngine.addOnload(function()
{
/*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'});