psych

Why are there differences between GPArotation::Varimax and stats::varimax?

给你一囗甜甜゛ 提交于 2019-12-13 06:06:38
问题 There are (at least) two different ways to varimax-rotate a loadings matrix in R, GPArotation::Varimax and stats::varimax . Oddly, even if the Kaiser-Normalization is enabled for both, they yield subtly different results. That's a bit of a pain for testing. library(GPArotation) library(psych) data("Thurstone") principal.unrotated <- principal(r = Thurstone, nfactors = 4, rotate = "none") # find unrotated PCs first loa <- unclass(principal.unrotated$loadings) varimax.stats <- stats::varimax(x

control digits printed by Hmisc::latex on a psych object

徘徊边缘 提交于 2019-12-13 01:47:18
问题 I've produced a comparison of correlation matrices using psych::cortest.mat. I'd like to put the output in a Sweave file for production with knitr. When I use the Hmisc::latex() function, it works, but it also produces about 7 digits for each result, which makes it really unattractive. I could just produce the output with the markup argument within knitr, but all the other tables in my document are more efficiently produced with latex output (results='asis') . Thoughts? #Sample data variable1

YAML, delayed_job : Psych vs Syck. How to make pysch read attr_accessors for a ruby object

回眸只為那壹抹淺笑 提交于 2019-12-12 17:09:41
问题 I'm having problems using delayed_job (3.0.3) with ruby 1.9.3. Previously we were using ruby 1.8.7 which comes with yaml syck parser which read all the attributes that are set for a ruby object (including attr_accessors) but with the upgrade to 1.9.3 the yaml parser was switched to psych (which was re-written) and it doesn't take into account any attributes except those persisted in the database. How can we make psych to take the attr_accessors into account as well. I tried to switch to syck

Fixing the “ruby installation is missing psych” error?

孤者浪人 提交于 2019-12-12 08:21:19
问题 I'm running Ruby ruby 1.9.3p125 and I keep getting this error which is making it impossible for me to do any kind of development in Rails. It seems your ruby installation is missing psych (for YAML output). To eliminate this warning, please install libyaml and reinstall your ruby. I've Googled around and tried seemingly everything but nothing seems to be working. I'm really eager to start on some new projects but can't seem to get around this hurdle. Any help is greatly appreciated! 回答1: I

Psych doc says «At the mid level is building an AST…» but, how exactly?

走远了吗. 提交于 2019-12-12 05:59:34
问题 I have this old code using Sych doing : yaml_as "tag:yaml.org,2002:#{self}" def to_yaml(opts = {}) YAML::quick_emit(self, opts) do |out| out.map(taguri, to_yaml_style) do |map| map.add('name', name) map.add('address', full_address.upcase) if full_address? end end end which outputs something like that : --- !Contact name: SMOKE OIL address: |- SMOKE OIL 1 RUE DE LA PAIX 75002 PARIS FRANCE Now, I'm upgrading that old code, going to Psych so, I read the doc and did : yaml_as "tag:yaml.org,2002:#

Expanding a Frequency Table Where the Variable Names are the Values

家住魔仙堡 提交于 2019-12-12 02:45:04
问题 I am working with a dataframe where each observation is linked to a specific ID, and I have a set of variables that define the "values" as if I had a factor variable. However, the value in the "cell" is the frequency. Here is a simplified version: ID 1 2 3 A 2 3 2 B 1 4 1 I would like to get two vectors that expand the frequencies so that I can calculate an interpolated median for each ID. That is, I'd like something of the form: A B 1 1 1 2 2 2 2 2 2 2 3 3 3 The psych package has a function

Output of fa2latex command from psych causing LaTeX error in pandoc

别说谁变了你拦得住时间么 提交于 2019-12-12 02:26:58
问题 I am writing a report using knitr in RStudio. Also using the psych package for factor analysis: ```{r, results='asis'} library(psych) data(Thurstone) fa.Thurstone<-fa(Thurstone) fa2latex(fa.Thurstone) ``` When I run this code chunk it causes an error: ! LaTeX Error: Unknown float option `d'. See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ... l.124 \begin{scriptsize} \begin{table}[htdp] pandoc: Error producing PDF from TeX source Error: pandoc

how can I retrieve / impute the underlying rotation matrix (rotmat) from psych::principal?

断了今生、忘了曾经 提交于 2019-12-12 02:07:51
问题 I'm using psych::principal in another function, with various rotate functions passed to principal . ( principal offers many rotation options and passes them on to different other functions). I need to get the rotation matrix that whichever rotation procedure was used found, and implemented. All of the downstream rotation procedures offer this, but it appears not to be return() ed by principal . For example: randomcor <- cor(matrix(data = rnorm(n = 100), nrow = 10)) library(psych) principalres

Fa2latex produces latex code that does not compile when produced in a Rmarkdown code chunk

☆樱花仙子☆ 提交于 2019-12-11 17:17:37
问题 I'm having difficulty using psych::fa2latex in the context of an RMarkdown document to produce a factor analysis result. If you just run the first bit of code in an RMarkdown document in RStudio (1.0.153), you get an error message : " LaTeX Error: \caption outside float” and the document does not compile. Thanks for any help. ##Place In RMarkdown Document, save and compile. --- title: "Test" author: "Simon Kiss" date: '2018-01-09' output: pdf_document --- ```{r setup, include=FALSE} knitr:

how do I find the angles between an original and a rotated PCA loadings matrix?

只谈情不闲聊 提交于 2019-12-11 11:07:47
问题 Suppose I have two matrices of PCA loadings loa.orig , and loa.rot , and I know that loa.rot is a rotation (by-hand or otherwise) of loa.orig . ( loa.orig might also have been already orthogonally rotated by varimax or something, but I don't think that matters). I know want to know the angles by which loa.orig has been rotated to arrive at loa.rot . I understand from this comment on another question that "rotations don't commute", and therefore, the order of pair-wise (plane-wise) rotations