[R] Difference betweeen cor.test() and formula everyone says to use

2014-10-16 Thread Jeremy Miles
I'm trying to understand how cor.test() is calculating the p-value of a correlation. It gives a p-value based on t, but every text I've ever seen gives the calculation based on z. For example: > data(cars) > with(cars[1:10, ], cor.test(speed, dist)) Pearson's product-moment correlation data: sp

[R] mice - undefined columns selected

2014-09-11 Thread Jeremy Miles
I've got a problem with the mice package that I don't understand. Here's the code: library(mice) d <- read.csv("https://dl.dropboxusercontent.com/u/24381951/employment.csv";, as.is=TRUE, row.names=1)d.imp <- mice(data=d, m=1) Result is: Error in `[.data.frame`(data, , jj) : undefined columns sel

Re: [R] metafor package: changing decimal in forest plot to midline decimal

2014-07-07 Thread Jeremy Miles
I've found that if you want really fine control over an issue like this in a chart, the easiest thing to do is to export it as PDF, and then directly edit the chart in Illustrator (not free) or Inkscape (free). On 7 July 2014 10:21, Viechtbauer Wolfgang (STAT) < wolfgang.viechtba...@maastrichtu

Re: [R] R for Android

2014-05-08 Thread Jeremy Miles
It exists: https://play.google.com/store/apps/details?id=com.appsopensource.R No graphics. Jeremy On 8 May 2014 05:44, Kevin E. Thorpe wrote: > This is a question asked purely out of idle curiosity (and may also be in > wrong list). Are there plans for porting R to Android devices or > chro

Re: [R] Lavaan Model Specification

2014-04-30 Thread Jeremy Miles
No picture attached, and you don't tell us what your trouble is, but your model has -4 df, so it's incorrectly specified. Take out these lines: congressmanAttitudes ~~ congressmenPerceptConstiuentAttitudes congressmenPerceptConstiuentAttitudes ~~ constiuentAttitudes rollCallBehav ~~ congressmenPe

Re: [R] lavaan fit indices & Chronbach's alphas

2014-03-26 Thread Jeremy Miles
On 26 March 2014 10:13, Dimitri Liakhovitski wrote: > Hello! > > I've run SEM using lavaan and after I used summary(myfit) I saw the > following fit indices: > > Model Chi Squared > CFI > TLI > RMSEA > SRMR > > I was wondering if these are the only fit indices lavaan produces, e.g.: > GFI > AGFI

Re: [R] Converting code to R Question

2013-02-25 Thread Jeremy Miles
Here's a direct translation: Variable <- 0 Variable <- ifelse(item1 == 1, Variable +1, Variable) Variable <- ifelse(item2 == 1, Variable +1, Variable) Variable <- ifelse(item3 == 1, Variable +1, Variable) Variable <- ifelse(item4 == 1, Variable +1, Variable) Here's another way to do it: Vari

Re: [R] MIMIC latent variable with PLS Path Modelling with R ?

2013-02-16 Thread Jeremy Miles
By MIMIC do you mean multiple indicator/multiple cause? Something like this: http://www.jeremymiles.co.uk/misc/fun/img059.gif If so, you can use sem, Lavaan, or openMx. Jeremy On 13 February 2013 05:11, Hervé Guyon wrote: > I want estimate MIMIC latent variable with R in a Monte Carlo simu

Re: [R] Interpret R-squared and cor in R

2013-02-15 Thread Jeremy Miles
On 15 February 2013 21:26, Janesh Devkota wrote: > Hi I am trying to find the relationship between two variables. > > First I fitted a linear model between two variables and I found the > following results: > Residual standard error: 0.03253 on 2498 degrees of freedom > Multiple R-squared: 0.5551

Re: [R] Question about Linear Regression

2012-12-28 Thread Jeremy Miles
You can run that as it is. The term to search for on Google is 'dummy coding'. Jeremy On 28 December 2012 07:45, Lorenzo Isella wrote: > > where x3 is a dichotomous variable assuming only 0 and 1 values (x1 and x2 > are continuous variables). > Is there any particular caveat I should be aware o

Re: [R] Non-linear regression analysis in R

2012-12-19 Thread Jeremy Miles
Could you provide the code that you're running, so we can see what you're trying to do? Even better would be a repeatable example. Jeremy On 19 December 2012 09:42, Yann Labou wrote: > Hey all, > > I'm trying to fit a non-linear model y ~ a * constant ^ b * x ^ c and > estimates the paramaters

Re: [R] Help for a function

2012-12-04 Thread Jeremy Miles
What are you expecting? What do you get? What is the problem? J On 4 December 2012 06:01, anoumou wrote: > Hello all, > I need a help. > I am modeling a disease and a create a R function like that: > > Lambda<-function (x,date1,r,h,a){ > ndate1 <- as.Date(date1, "%d/%m/%Y") > t1 <- as.nume

Re: [R] Replacing string in matrix with zero

2012-11-14 Thread Jeremy Miles
You can use ifelse() #Create data for example x <- matrix(data=c(Inf, 2, 3, 4, Inf, 6, 7, 8, Inf), nrow=3) #Turn Inf into zero. x <- ifelse(x == Inf, 0, x) Jeremy On 14 November 2012 14:13, Nick Duncan wrote: > Dear All, > > I have a matrix in which the diagonal has the string "Inf" in it.

Re: [R] R and SPSS

2012-11-06 Thread Jeremy Miles
I think we'll need some output to know so we can see the differences. (And data and code would be useful too, if you could provide a small example). One thought is that the programs might remove a variable that is completely collinear, but the different programs might remove different variables -

Re: [R] Error: object 'CO2' not found

2012-10-22 Thread Jeremy Miles
You need to load the dataset. First, run data(CO2) Then it should work. Jeremy [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www

Re: [R] negative AIC and BIC values in gls

2012-08-22 Thread Jeremy Miles
It's fine. Just interpret them as you would any other (lower is better). On 22 August 2012 16:43, Gary Dong wrote: > Dear R users, > > I obtained negative AIC and BIC and positive Loglik values in a gls model. > Is this normal? how should I interpret them? Thanks! > >AIC BIC

Re: [R] Metafor package: Including multiple (categorical) predictors

2012-08-02 Thread Jeremy Miles
The test of moderator coefficients (QM) is chi-square distributed.You can use the change in this value when you add a predictor to the model as a chi-square test, with df equal to the change in df. Jeremy On 2 August 2012 05:54, Bexkens, Anika wrote: > Dear Metafor users, > > I'd like to test a

Re: [R] help in interpreting paired t-test

2011-09-21 Thread Jeremy Miles
> cor(A, B) [1] 0.9986861 The data are very, very highly correlated. The higher the correlation, the greater the power of the t-test to detect the same difference between the means. Jeremy On 20 September 2011 10:46, Pedro Mardones wrote: > Dear all; > > A very basic question. I have the follow

Re: [R] Differences in SAS and R defaults

2011-08-29 Thread Jeremy Miles
Do you mean things like treatment of categorical variables in regression procedures (which have different defaults in different procedures in SAS), and different default as to the reference category in logistic regression? Jeremy On 29 August 2011 04:46, n wrote: > Hello all, > > I am looking

Re: [R] questions about "metafor" package

2011-08-17 Thread Jeremy Miles
. > > - Firstly, for each observation, I have means for a treatment and for > a control, but I don’t always have corresponding standard deviations (52 of a > total of 93 observations don’t have standard deviations). Nevertheless I have > the sample sizes for all observations so I wonder

Re: [R] Automatic creation of binary logistic models

2011-08-04 Thread Jeremy Miles
Sounds like you want a best subsets regression, the bestglm() function, found in the bestglm() package will do the trick. Jeremy On 4 August 2011 12:23, Paul Smith wrote: > Dear All, > > Suppose that you are trying to create a binary logistic model by > trying different combinations of predicto

Re: [R] How to search for R related topics in search engines?

2011-07-27 Thread Jeremy Miles
Use rseek.org. Jeremy On 27 July 2011 07:12, Paul Menzel wrote: > Dear R folks, > > > I am having problems getting good results when searching for R related > topics, that means I have not found out yet what keywords I should use > to get only relevant results. Most of the time I get also MATLAB

Re: [R] Message for R-help mailing list

2011-07-26 Thread Jeremy Miles
This is clearly a message for the R-help mailing list, since it was sent to the R help mailing list. fisher.test(x)[1] Jeremy On 26 July 2011 14:51, Zmarz, Pawel wrote: > Dear r-helpers, > > I would be very grateful if you could post the message below on the r-help > discussion board. Than

Re: [R] function lm, get back the coefficient

2011-07-26 Thread Jeremy Miles
Will: result$coef[[2]] Give you want you want? Jeremy On 26 July 2011 08:21, ascoquel wrote: > Hi, > > I've done a linear fit on my data and I would like to get back the a (time) > coefficient ... > > mod<-lm(res_sql2$Lx0x~0+time) > result<-data.frame() > result<-coef(mod) > print("result")

Re: [R] Extract elements from objects in a list

2011-06-28 Thread Jeremy Miles
.5209 0.5635 0.4789 0.5428 0.5372 0.5403 0.5086 0.5470 0.4219 0.4758 > 0.4824 0.5165 0.5035 0.4833 0.4754 0.5227 > Median Median Median Median > 0.6169 0.4904 0.4773 0.4779 > > On Tue, Jun 28, 2011 at 7:22 PM, Jeremy Miles wrote: >> Hi All, >> >> I want to extract elem

[R] Extract elements from objects in a list

2011-06-28 Thread Jeremy Miles
Hi All, I want to extract elements of elements in a list. Here's an example of what I mean: If I create a list: x <- as.list(100) for(loop in c(1:100)) { x[[loop]] <- summary(runif(100)) } > head(x) [[1]] Min. 1st Qu. MedianMean 3rd Qu.Max. 0.02271 0.25260 0.58130

Re: [R] Factor Analysis with orthogonal and oblique rotation

2011-06-22 Thread Jeremy Miles
Varimax is orthogonal, promax is oblique. Varimax is generally not recommended. See: Preacher, K. J., & MacCallum, R. C. (2003). Repairing Tom Swift's electric factor analysis machine. Understanding Statistics, 2(1), 13-43. (Google the title and you'll find a PDF). The fa() function in the psy

Re: [R] Bartlett's Test of Sphericity

2011-06-17 Thread Jeremy Miles
cortest.bartlett() in the psych package. I've never seen a non-significant Bartlett's test. Jeremy On 17 June 2011 12:43, thibault grava wrote: > Hello Dear R user, > > I want to conduct a Principal components analysis and I need to run two > tests to check whether I can do it or not. I found

Re: [R] BIZARRE results from wilcox.test()

2011-06-14 Thread Jeremy Miles
The results weren't BIZARRE (or even bizarre). You didn't understand them, but that doesn't make them bizarre. (I didn't understand them either, but thanks to the replies, now I do). Why not send something more similar to your dataset to ensure you get relevant answers ? Jeremy On 14 June 20

Re: [R] Results of CFA with Lavaan

2011-06-08 Thread Jeremy Miles
What do you mean by latent estimate? The table of variances has variances for each factors. Is there something different in the sem output that you don't see here? Yes, this looks normal. Jeremy On 8 June 2011 13:14, R Help wrote: > I've just found the lavaan package, and I really apprecia

Re: [R] best subset regression in R

2011-05-04 Thread Jeremy Miles
ion+R , and sends me to this page: http://www.statmethods.net/stats/regression.html Jeremy -- Jeremy Miles Support Dan and Alex's school: Vote for Goethe Charter School to receive a grant from Pepsi to help build a library: http://www.refreshe

Re: [R] fisher exact for > 2x2 table

2011-04-29 Thread Jeremy Miles
x27;s exact test was extended to general R×C tables by Freeman and Halton (1951), and this test is *also* known as the Freeman-Halton test." Emphasis mine. Jeremy -- Jeremy Miles Psychology Research Methods Wiki: www.researchmethodsinpsychology.com __

Re: [R] Rcmdr vs SPSS in hungarian

2011-04-21 Thread Jeremy Miles
__ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > > -- Jeremy Miles Psy

Re: [R] Rcmdr vs SPSS

2011-04-20 Thread Jeremy Miles
0,27197 > 0,36261 > 0,83618 > 1,01805 > 0,89368 > -0,46300 > -3,29729 > > This wrong??? > >        [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do

Re: [R] Monte Carlo Simulation

2011-04-15 Thread Jeremy Miles
to know about write.table() for the saving the files, or is the problem with splitting a large file, or generating the 1000 names ... Jeremy -- Jeremy Miles Psychology Research Methods Wiki: www.researchmethodsinpsychology.com __ R-help@r-project.o

Re: [R] Correlation Matrix

2011-04-07 Thread Jeremy Miles
On 7 April 2011 12:09, Dmitry Berman wrote: > Listers, > > I have a question regarding correlation matrices. It is fairly straight > forward to build a correlation matrix of an entire data frame. I simply use > the command cor(MyDataFrame). However, what I would like to do is construct > a smaller

Re: [R] Structural equation modeling in R(lavaan,sem)

2011-04-03 Thread Jeremy Miles
mnet. You can join it here: http://www2.gsu.edu/~mkteer/semnet.html#Joining. Jeremy -- Jeremy Miles Psychology Research Methods Wiki: www.researchmethodsinpsychology.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo

Re: [R] Structural equation modeling in R(lavaan,sem)

2011-03-29 Thread Jeremy Miles
__ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, rep

Re: [R] Structural equation modeling in R(lavaan,sem)

2011-03-28 Thread Jeremy Miles
4,NA > x7 <->x7 ,sigmma5,NA > x6 <->x6 ,sigmma6,NA > > It's a somewhat unusual looking model. What are you trying to do? Jeremy -- Jeremy Miles Psychology Research Methods Wiki: www.researchmethodsinpsychology.com [[alternative HTML version deleted]]

Re: [R] Structural equation modeling in R(lavaan,sem)

2011-03-27 Thread Jeremy Miles
Again, I should reiterate that you have a hard road in front of you, and it will be made much easier if you read a couple of introductory SEM texts, which will answer this sort of question. Jeremy -- Jeremy Miles Psychology Research Methods Wiki: www.researchmethodsinpsychology.com

Re: [R] testing power of correlation

2011-03-05 Thread Jeremy Miles
info/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Jeremy Miles Psychology Research Methods Wiki: www.researchmethodsinpsychology.com ___

Re: [R] sem problem - did not converge

2011-02-14 Thread Jeremy Miles
 0.2043732  0.1923942 >> eigen(dados40.cov)$values >  [1] 884020.98 337855.95 138823.30 126291.58  87915.21  79207.04  73442.71 >  [8]  68388.11  60625.26  58356.54  55934.05  54024.00  50505.10  48680.26 > [15]  46836.47  45151.23  43213.65  41465.42  40449.59  37824.73  376

Re: [R] Revolution Analytics reading SAS datasets

2011-02-10 Thread Jeremy Miles
On 10 February 2011 12:01, Matt Shotwell wrote: > On Thu, 2011-02-10 at 10:44 -0800, David Smith wrote: >> The SAS import/export feature of Revolution R Enterprise 4.2 isn't >> open-source, so we can't release it in open-source Revolution R >> Community, or to CRAN as we do with the ParallelR pack

[R] Generate data from correlation matrix

2011-02-07 Thread Jeremy Miles
eremy -- Jeremy Miles Psychology Research Methods Wiki: www.researchmethodsinpsychology.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htm

Re: [R] HLM Model

2011-01-27 Thread Jeremy Miles
gt; > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. &g

[R] Merge() error

2010-12-13 Thread Jeremy Miles
frames does not bt <- merge( bt, np, by=("caseid"), all=TRUE) # Changed from np, bt to bt,np. The code always worked fine before, until someone 'helpfully' duplicated some of the variables across the data frames, so in addition to caseid, each also contains Autho

Re: [R] how do I make a correlation matrix positive definite?

2010-10-21 Thread Jeremy Miles
27;t seen this complication, but obviously >> all entries must remain in (-1,1) range after conversion.] >> >> Any R tools to handle this? >> >> I'd appreciate any help. >> >> Hakan Demirtas >> >> >> [[alternative HTML version deleted]] >> >> ___

Re: [R] how do I make a correlation matrix positive definite?

2010-10-21 Thread Jeremy Miles
gt; Hakan Demirtas > > >        [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html

Re: [R] FDR

2010-10-07 Thread Jeremy Miles
posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Jeremy Miles Psychology Research Methods Wiki: www.researchmethodsinpsychology.com [[alternative HTML version deleted]] ___

Re: [R] can I add line breaks to the paste() function?

2010-09-30 Thread Jeremy Miles
o read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Jeremy Miles Psychology Research Methods Wiki: www.researchmethodsinpsychology.com __ R-help@r-proj

Re: [R] R Founding

2010-09-16 Thread Jeremy Miles
any open source projects have a 'donate with paypal' button. Jeremy -- Jeremy Miles Psychology Research Methods Wiki: www.researchmethodsinpsychology.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE

Re: [R] which one give clear picture-pdf, jpg or tiff?

2010-08-19 Thread Jeremy Miles
> R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible cod

Re: [R] meta-analysis in R

2010-08-19 Thread Jeremy Miles
> books. Can anyone > kindly help? Thank you in advance. > We can try, but tell us what you want to do. Jeremy -- Jeremy Miles Psychology Research Methods Wiki: www.researchmethodsinpsychology.com __ R-help@r-project.org mailing list h

Re: [R] A %nin% operator?

2010-08-05 Thread Jeremy Miles
Ken Williams > > > David Winsemius, MD > West Hartford, CT > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >

[R] Function to return variable name

2010-07-28 Thread Jeremy Miles
I'd like a function that returns the variable name. As in: MyData$Var1 Would return: Var1 There should be a straightforward way to do this, but I can't see it. Thanks, Jeremy -- Jeremy Miles Psychology Research Methods Wiki: www.researchmethodsinpsyc

Re: [R] Note on PCA (not directly with R)

2010-06-30 Thread Jeremy Miles
the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Jeremy Miles Psychology Research Methods Wiki: www.researchmethodsinpsychology.com __ R-help@r-project.o

Re: [R] Logistic regression with multiple imputation

2010-06-29 Thread Jeremy Miles
> R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Jeremy Miles Psychology Research Meth

Re: [R] Popularity of R, SAS, SPSS, Stata...

2010-06-24 Thread Jeremy Miles
t; > > > > -- > Joris Meys > Statistical consultant > > Ghent University > Faculty of Bioscience Engineering > Department of Applied mathematics, biometrics and process control > > tel : +32 9 264 59 87 > joris.m...@ugent.be >

Re: [R] Is there a non-parametric repeated-measures Anova in R ?

2010-06-16 Thread Jeremy Miles
It's possible to use the ordinal regression model if your data are ordered categories. The standard non-parametric test is the Friedman test. ?friedman.test Jeremy On 16 June 2010 10:22, Tal Galili wrote: > Hello Prof. Harrell and dear R-help mailing list, > > I wish to perform a non-parametri

[R] Dataframe to word, using R2wd

2010-05-14 Thread Jeremy Miles
ayout. (I can't work out what the table is - it seems to be nested tables. Converting to text gives one long column.) Using wdBody(MyDataFrame) or wdNormal(MyDataFrame) Is there another way to use R2wd to send the dataframe to word? Thanks (in advance) Jeremy -- Jeremy Miles Psyc

Re: [R] Nonparametric generalization of ANOVA

2010-03-05 Thread Jeremy Miles
> R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Jeremy

Re: [R] R ANOVA gives diferent results than SPSS

2010-02-11 Thread Jeremy Miles
.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Jeremy Miles Psychology Research Methods Wiki: www.researchmethodsinpsychology.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/

Re: [R] Structural Equation Models(SEM)

2009-12-02 Thread Jeremy Miles
> R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Jeremy Miles P

Re: [R] Simple 2-Way Anova issue in R

2009-11-08 Thread Jeremy Miles
text: > http://old.nabble.com/Simple-2-Way-Anova-issue-in-R-tp26258684p26258684.html > Sent from the R help mailing list archive at Nabble.com. > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help >