[R] Behaviors of diag() with character vector in R 3.0.0

2013-04-09 Thread Mike Cheung
Dear all, According to CHANGES IN R 3.0.0: o diag() as used to generate a diagonal matrix has been re-written in C for speed and less memory usage. It now forces the result to be numeric in the case diag(x) since it is said to have 'zero off-diagonal entries'. diag(x) does

Re: [R] Behaviors of diag() with character vector in R 3.0.0

2013-04-09 Thread Mike Cheung
0 0 #[2,] 0 b 0 0 0 #[3,] 0 0 c 0 0 #[4,] 0 0 0 d 0 #[5,] 0 0 0 0 e A.K. - Original Message - From: Mike Cheung mikewlche...@gmail.com To: r-help r-help@r-project.org Cc: Sent: Tuesday, April 9, 2013 3:15 AM Subject: [R] Behaviors of diag() with character

Re: [R] questions about metafor package

2011-08-22 Thread Mike Cheung
Hi, Emilie. For your second question. You may check Gleser and Olkin (2009). They gave several formulas to estimate the sampling covariance for dependent effect sizes. One of them can be applied in your case. Gleser, L. J., Olkin, I. (2009). Stochastically dependent effect sizes. In H. Cooper,

Re: [R] error in model specification for cfa with lavaan-package

2011-06-01 Thread Mike Cheung
Dear Alain, There were 16 variables with 10 cases with missing values. The sample covariance matrix is not positive definite. It has nothing to do with lavaan. You need more cases before you can fit a CFA with 16 variables. Regards, Mike --

Re: [R] error in model specification for cfa with lavaan-package

2011-06-01 Thread Mike Cheung
Dear Alain, You may speed up the analysis by using the sample covariance matrix based on a listwise deletion: cov.cfa - cov(your.raw.data, use=complete.obs) Since you have 36671 cases, the results should be similar to those based on the raw data unless you have lots of missing data and/or the

Re: [R] Meta-analysis of a correlation matrix

2011-04-11 Thread Mike Cheung
Dear luri, The metaSEM package (http://courses.nus.edu.sg/course/psycwlm/Internet/metaSEM/) may be used to fit structural equation models on the pooled correlation/covariance matrices with weighted least squares as the estimation method. You may refer to the examples in tssem1() and tssem2().

Re: [R] Incorrect degrees of freedom in SEM model using lavaan

2011-03-17 Thread Mike Cheung
Dear Andrew, The reported df in lavaan is 0 which is correct. It is because this path model is saturated. 28 is not the df, it is the no. of pieces of information. The no. of parameter estimates is also 28. Thus, the df is 0. However, you are correct that there are only 13, not 28, free

Re: [R] Random Effects Meta Regression

2011-01-07 Thread Mike Cheung
Hi Steph, You may try the metafor package http://cran.r-project.org/web/packages/metafor/index.html Regards, Mike -- - Mike W.L. Cheung Phone: (65) 6516-3702 Department of Psychology Fax: (65) 6773-1843

Re: [R] meta analysis with repeated measure-designs?

2010-06-18 Thread Mike Cheung
Phone: (65) 6516-3702 Department of Psychology Fax: (65) 6773-1843 National University of Singapore http://courses.nus.edu.sg/course/psycwlm/internet/ - On Wed, Jun 16, 2010 at 4:47 PM, Mike Cheung mikewlche...@gmail.com

Re: [R] meta analysis with repeated measure-designs?

2010-06-16 Thread Mike Cheung
Dear Gerrit, If the correlations of the dependent effect sizes are unknown, one approach is to conduct the meta-analysis by assuming that the effect sizes are independent. A robust standard error is then calculated to adjust for the dependence. You may refer to Hedges et. al., (2010) for more

Re: [R] Comparing the correlations coefficient of two (very) dependent samples

2010-05-03 Thread Mike Cheung
Dear Tal, There are several approaches in doing it (see Steiger, 2003). It should not be difficult to implement them in R. Steiger, J.H. (2003). Comparing correlations. In A. Maydeu-Olivares (Ed.) Psychometrics. A festschrift to Roderick P. McDonald. Mahwah, NJ: Lawrence Erlbaum Associates.

Re: [R] metafor package: effect sizes are not fully independent

2010-02-07 Thread Mike Cheung
Dear Gang, Here are just some general thoughts. Wolfgang Viechtbauer will be a better position to answer questions related to metafor. For multivariate effect sizes, we first have to estimate the asymptotic sampling covariance matrix among the effect sizes. Formulas for some common effect sizes

Re: [R] metafor package: effect sizes are not fully independent

2010-02-07 Thread Mike Cheung
(weighted average?) before the meta analysis? Your suggestions are highly appreciated. Best wishes, Gang On Sun, Feb 7, 2010 at 10:39 AM, Mike Cheung mikewlche...@gmail.com wrote: Dear Gang, Here are just some general thoughts. Wolfgang Viechtbauer will be a better position to answer

Re: [R] Meta-Analyisis on Correlations

2009-02-13 Thread Mike Cheung
Dear Sebastian, Many researchers may transform the Pearson coefficients into Fisher's z scores first by using z - 0.5*log((1+r)/(1-r)). The standard errors of the Fisher's z scores are z.SE - 1/sqrt(n-3) where n are the sample sizes (see http://en.wikipedia.org/wiki/Fisher_transformation).

Re: [R] Constrained regression

2008-03-03 Thread Mike Cheung
Dear Carlos, One approach is to use structural equation modeling (SEM). Some SEM packages, such as LISREL, Mplus and Mx, allow inequality and nonlinear constraints. Phantom variables (Rindskopf, 1984) may be used to impose inequality constraints. Your model is basically: y = b0 + b1*b1*x1 +