I am trying to simulate a dataset using Parallel Latent CTT model and this is what i have done so far: (START) #Importing psych library for all the simulation related functions library(psych) # Settting the working directory path to C:/NCME path="C:/NCME" setwd(path) #Using the function to generate the data GenData <- congeneric.sim(N=500, loads = c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1), short = FALSE) #Rounding upto 2 decimal places while showing the correlation matrix round(cor(GenData$observed),2) #Factor Score FactorScore=factor.pa(GenData$observed,1,scores = "TRUE", rotate="none") round(cor(FactorScore$scores,GenData$latent),2) (END) Please let me know if I am moving into the right direction, if not then, please let me know the correct way to simulate the dataset Thanks in Advance Regards, Nidhi Kohli *************************************** Nidhi Kohli, M.Ed. Doctoral Student Department of Measurement, Statistics and Evaluation University of Maryland 1230 Benjamin Building College Park, MD 20742-1115 e-mail: nidhik at umd.edu
William Revelle
2008-Dec-26 17:31 UTC
[R] Simulating dataset using Parallel Latent CTT model?
Nidhi, Presumably, you are trying to simulate 20 items all sharing one general factor but having some error. The model as you specified it has no error. Thus all the correlations will be 1 and the factors will not make any sense. Most items have loadings on a general factor of the order of about .4 to .6. You might try: GenData <- congeneric.sim(N=500, loads = rep(.5,20), short = FALSE) Then you will find that the factor scores found by factor.pa correlate at .93 with the latent variable.> FactorScore=factor.pa(GenData$observed,1,scores = "TRUE", rotate="none") > round(cor(FactorScore$scores,GenData$latent),2)Bill At 8:27 AM -0500 12/26/08, Nidhi Kohli wrote:>I am trying to simulate a dataset using Parallel Latent CTT model >and this is what i have done so far: > >(START) > >#Importing psych library for all the simulation related functions > >library(psych) > ># Settting the working directory path to C:/NCME > >path="C:/NCME" >setwd(path) > >#Using the function to generate the data > >GenData <- congeneric.sim(N=500, loads = >c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1), short = FALSE) > >#Rounding upto 2 decimal places while showing the correlation matrix > >round(cor(GenData$observed),2) > >#Factor Score >FactorScore=factor.pa(GenData$observed,1,scores = "TRUE", rotate="none") >round(cor(FactorScore$scores,GenData$latent),2) > >(END) > >Please let me know if I am moving into the right direction, if not >then, please let me know the correct way to simulate the dataset > >Thanks in Advance > >Regards, > >Nidhi Kohli >*************************************** >Nidhi Kohli, M.Ed. >Doctoral Student >Department of Measurement, Statistics > and Evaluation >University of Maryland >1230 Benjamin Building >College Park, MD 20742-1115 > >e-mail: nidhik at umd.edu > >______________________________________________ >R-help at 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.-- William Revelle http://personality-project.org/revelle.html Professor http://personality-project.org/personality.html Department of Psychology http://www.wcas.northwestern.edu/psych/ Northwestern University http://www.northwestern.edu/ Attend ISSID/ARP:2009 http://issid.org/issid.2009/
Hi Bill, Thank you very much for your response. You are right, I want to simulate data set for 500 examinees across 20 items using Parallel latent CTT model. As you know in Parallel Latent CTT model all the error variances and factor loadings are equal across all the items. Could you please let me know how can I incorporate common error variance for 20 items in this R-program? Regards, Nidhi Kohli *************************************** Nidhi Kohli, M.Ed. Doctoral Student Department of Measurement, Statistics and Evaluation University of Maryland 1230 Benjamin Building College Park, MD 20742-1115 e-mail: nidhik at umd.edu *************************************** ---- Original message ---->Date: Fri, 26 Dec 2008 11:31:10 -0600 >From: William Revelle <lists at revelle.net> >Subject: Re: [R] Simulating dataset using Parallel Latent CTT model? >To: Nidhi Kohli <nidhik at umd.edu>, r-help at r-project.org > >Nidhi, > > > >Presumably, you are trying to simulate 20 items all sharing one >general factor but having some error. > >The model as you specified it has no error. Thus all the >correlations will be 1 and the factors will not make any sense. > >Most items have loadings on a general factor of the order of about >.4 to .6. You might try: > >GenData <- congeneric.sim(N=500, loads = rep(.5,20), short = FALSE) >Then you will find that the factor scores found by factor.pa >correlate at .93 with the latent variable. > >> FactorScore=factor.pa(GenData$observed,1,scores = "TRUE", rotate="none") >> round(cor(FactorScore$scores,GenData$latent),2) > >Bill > > > > >At 8:27 AM -0500 12/26/08, Nidhi Kohli wrote: >>I am trying to simulate a dataset using Parallel Latent CTT model >>and this is what i have done so far: >> >>(START) >> >>#Importing psych library for all the simulation related functions >> >>library(psych) >> >># Settting the working directory path to C:/NCME >> >>path="C:/NCME" >>setwd(path) >> >>#Using the function to generate the data >> >>GenData <- congeneric.sim(N=500, loads = >>c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1), short = FALSE) >> >>#Rounding upto 2 decimal places while showing the correlation matrix >> >>round(cor(GenData$observed),2) >> >>#Factor Score >>FactorScore=factor.pa(GenData$observed,1,scores = "TRUE", rotate="none") >>round(cor(FactorScore$scores,GenData$latent),2) >> >>(END) >> >>Please let me know if I am moving into the right direction, if not >>then, please let me know the correct way to simulate the dataset >> >>Thanks in Advance >> >>Regards, >> >>Nidhi Kohli >>*************************************** >>Nidhi Kohli, M.Ed. >>Doctoral Student >>Department of Measurement, Statistics >> and Evaluation >>University of Maryland >>1230 Benjamin Building >>College Park, MD 20742-1115 >> >>e-mail: nidhik at umd.edu >> >>______________________________________________ >>R-help at 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. > > >-- >William Revelle http://personality-project.org/revelle.html >Professor http://personality-project.org/personality.html >Department of Psychology http://www.wcas.northwestern.edu/psych/ >Northwestern University http://www.northwestern.edu/ >Attend ISSID/ARP:2009 http://issid.org/issid.2009/
William Revelle
2008-Dec-27 17:00 UTC
[R] Simulating dataset using Parallel Latent CTT model?
Nidhi, As I said in my previous response, if you want 20 items with equal factor loadings you can just specify the loading: e.g., for all loadings of .6 GenData <- congeneric.sim(N=500, loads = rep(.6,20), short = FALSE) The error variances will all be equal to 1 - loading^2 where loading is the factor loading you specified. This is R. If you want to know how a function works, list the source code. Bill At 9:47 AM -0500 12/27/08, Nidhi Kohli wrote:>Hi Bill, > >Thank you very much for your response. You are right, I want to >simulate data set for 500 examinees across 20 items using Parallel >latent CTT model. As you know in Parallel Latent CTT model all the >error variances and factor loadings are equal across all the items. >Could you please let me know how can I incorporate common error >variance for 20 items in this R-program? > >Regards, > >Nidhi Kohli >*************************************** >Nidhi Kohli, M.Ed. >Doctoral Student >Department of Measurement, Statistics > and Evaluation >University of Maryland >1230 Benjamin Building >College Park, MD 20742-1115 > >e-mail: nidhik at umd.edu >*************************************** > > >---- Original message ---- > >Date: Fri, 26 Dec 2008 11:31:10 -0600 > >From: William Revelle <lists at revelle.net> >>Subject: Re: [R] Simulating dataset using Parallel Latent CTT model? >>To: Nidhi Kohli <nidhik at umd.edu>, r-help at r-project.org >> >>Nidhi, >> >> >> >>Presumably, you are trying to simulate 20 items all sharing one >>general factor but having some error. >> >>The model as you specified it has no error. Thus all the >>correlations will be 1 and the factors will not make any sense. >> >>Most items have loadings on a general factor of the order of about >>.4 to .6. You might try: >> > >GenData <- congeneric.sim(N=500, loads = rep(.5,20), short = FALSE) >>Then you will find that the factor scores found by factor.pa >>correlate at .93 with the latent variable. >> >>> FactorScore=factor.pa(GenData$observed,1,scores = "TRUE", rotate="none") >>> round(cor(FactorScore$scores,GenData$latent),2) >> >>Bill >> >> >> >> >>At 8:27 AM -0500 12/26/08, Nidhi Kohli wrote: >>>I am trying to simulate a dataset using Parallel Latent CTT model >>>and this is what i have done so far: >>> >>>(START) >>> >>>#Importing psych library for all the simulation related functions >>> >>>library(psych) >>> >>># Settting the working directory path to C:/NCME >>> >>>path="C:/NCME" >>>setwd(path) >>> >>>#Using the function to generate the data >>> >>>GenData <- congeneric.sim(N=500, loads >>>c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1), short = FALSE) >>> >>>#Rounding upto 2 decimal places while showing the correlation matrix >>> >>>round(cor(GenData$observed),2) >>> >>>#Factor Score >>>FactorScore=factor.pa(GenData$observed,1,scores = "TRUE", rotate="none") >>>round(cor(FactorScore$scores,GenData$latent),2) >>> >>>(END) >>> >>>Please let me know if I am moving into the right direction, if not >>>then, please let me know the correct way to simulate the dataset >>> >>>Thanks in Advance >>> >>>Regards, >>> >>>Nidhi Kohli >>>*************************************** >>>Nidhi Kohli, M.Ed. >>>Doctoral Student >>>Department of Measurement, Statistics >>> and Evaluation >>>University of Maryland >>>1230 Benjamin Building >>>College Park, MD 20742-1115 >>> >>>e-mail: nidhik at umd.edu >>> >>>______________________________________________ >>>R-help at 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. >> >> >>-- >>William Revelle http://personality-project.org/revelle.html >>Professor http://personality-project.org/personality.html >>Department of Psychology http://www.wcas.northwestern.edu/psych/ >>Northwestern University http://www.northwestern.edu/ >>Attend ISSID/ARP:2009 http://issid.org/issid.2009/-- William Revelle http://personality-project.org/revelle.html Professor http://personality-project.org/personality.html Department of Psychology http://www.wcas.northwestern.edu/psych/ Northwestern University http://www.northwestern.edu/ Attend ISSID/ARP:2009 http://issid.org/issid.2009/