Search results

  1. Lazar

    formatting issues

    You might want to give us something to work with. Can you post the output of : dput(head(mydata)) before you try manipulating the dates?
  2. Lazar

    Compare non-latent variables across groups

    So your aim should be to apply your underlying theory of measurement to your data. Creating a latent variable only makes sense if your theory implies that your four variables of interest are indicators of a latent factor. So I think the best thing for you to do is provide more detail on what you...
  3. Lazar

    Compare non-latent variables across groups

    Invariance is a test of the similarity of parameters between 2 or more groups. So the question is what parameters are you interested in?
  4. Lazar

    Graphically display results of ANCOVA

    Here is a worked example using the R dataset iris: data(iris) # This will get the marginal means require(ggeffects) #This is for ploting require(ggplot2) #The model m1 <- lm(Sepal.Length ~ Sepal.Width + Species, iris) # Get the marginal means. By default will be evaluated at the mean for...
  5. Lazar

    Mediation with clustered standard errors

    Only for the summary results of the individual models. You can get those using coef_test function https://cran.r-project.org/web/packages/clubSandwich/vignettes/panel-data-CRVE.html
  6. Lazar

    Mediation with clustered standard errors

    you should just be able to say cluster="cluster_id_variable" where cluster_id_variable is the name of the column with the cluster ids.
  7. Lazar

    Mediation with clustered standard errors

    How do you want to deal with the clustering? Cluster robust standard errors, random effects, or fixed effects?
  8. Lazar

    R to collaborative Google Docs workflow ideas

    I think this might do the job. https://gist.github.com/pdparker/fecf1be5516bff4582a400e04ffba2cb but this is my first google app script so no promise that it works consistently.
  9. Lazar

    Repeated Measures RCT mediation help

    I have a repeated measures dataset with baseline and 12 and 24 month follow-up. I need to fit a mediation model to this data. I am unsure whether my approach (see below) makes sense. The questions I have are: 1. If the model has Poisson link function for the outcome is the traditional a*b...
  10. Lazar

    R to collaborative Google Docs workflow ideas

    TL;DR; I am looking for workflow ideas to dynamically import tables and figures into a google doc that I am working on collaboratively with multiple people. I find myself working a lot with colleagues on google docs who are not sufficiently familiar with R or markdown to use .Rmd files. I am...
  11. Lazar

    IV Regression with binary outcome

    I have a binary variable y which I am aiming to model using instrumental variable regression. Both X and the IV are continuous. ivpak in R does not seem to provide a means for accounting for a binary outcome. Is there a means of accounting for this in R?
  12. Lazar

    Linear Probability Models and Complex Survey Data

    So there has been a movement back toward linear probability models in cases in which multi-group comparisons are of focal interest. The rational for this is that cross-group comparisons of parameter estimates get shaky in probit and logit models requiring a bunch of finessing to get right...
  13. Lazar

    rmongodb: Return count of all instances within a document

    I have a mongodb with 21,000 documents. The fields include: _id, dateOfSpeech, speaker, speechType, and speechTranscript. I want to construct a query of the speechTranscript field that returns the count of the number of times a given pattern occurs in a document. So far I have only been able...
  14. Lazar

    linear probability models: heteroscedasticity

    I have to run linear probability models rather than logistic regression models (dichotomous endogenous variable) and I am wanting to look for a way of dealing with heteroscedasticity to get correct standard errors. I wonder whether using robust weighted least squares in the R package lavaan for...
  15. Lazar

    GIS data questions

    Hi All, I have to get some GIS data for a project I am working on but I honestly have no idea where to start. What I need is as follows: 1. I need to get the lat and long of the point in a post/zip code with the highest population density (post codes are from Australia). I have the geographic...
  16. Lazar

    makefile knitr

    Ok so I want to make a makefile that will find all .Rmd files and convert them to html files. I have a make file the works but I want to work loop through the .Rmd and then .md files. Here is what I have so far: # test comment all: Day1Part1-Introduction.md Day1Part1-Introduction.html \...
  17. Lazar

    weighted correlation

    Hi Folks, So I have data that looks like: myData <- structure(list(total = c(0.154, 0.223, 0.252, 0.157, 0.196, 0.252, 0.198, 0.162, 0.222, 0.135, 0.196, 0.193, 0.192, 0.274, 0.177, 0.17, 0.214, 0.214, 0.107, 0.22, 0.177, 0.177, 0.165, 0.226, 0.196, 0.267, 0.174, 0.12, 0.159), totalse...
  18. Lazar

    Cross-classification BUGS

    Hi All, I have a hierarchical Bayes model that looks like: model{ #Overaching model for (i in 1:n){ y[i] ~ dnorm (yHat[i], tau.y) yHat[i] <- a[id[i]] + b.group*group[i] + b.wave*wave[i] + b.int*wave[i]*group[i] } #Fixed Effects b.group ~ dnorm(0, .0001) b.wave ~...
  19. Lazar

    Add Regular Expressions RSQLite

    So I want to add regular expressions to sqlite for queries via R. SQLite does not come with regular expressions but has keywords assigned and thus you have to add the functionality yourself http://www.ashleyit.com/blogs/brentashley/2013/11/27/using-regular-expressions-with-sqlite/ So anyone...
  20. Lazar

    Calling Python from R

    So I am trying to call python from R so I can use beautiful soup. I have tried both >system("python myfile.py") and >library(rPython) >python.exec("import bs4 some more python script here") The issue I am running into in both cases is I get back "No module named bs4" I think the...