search for: specifymodel

Displaying 14 results from an estimated 14 matches for "specifymodel".

2012 Aug 03
1
SEM standardized path coefficients
...ll.S, n2S, NA All.S -> All.S, S2S, NA NDVI <-> NDVI, n2n, 1 df = read.csv('NDVI_lep_data.csv',header=T) cor(df[,c('NDVI','All.S')]) yields: NDVI All.S NDVI 1.0000000 0.4156191 All.S 0.4156191 1.0000000 But, conducting an SEM yields: sem.mod = specifyModel('SEM_NDVI_AllS_model.txt') sem.mod.cov = rawMoments(~ NDVI + All.S, data = df) sem.mod.cov = sem.mod.cov[-1,-1] sem.mod.cov NDVI All.S NDVI 0.7820657 13.53573 All.S 13.5357259 245.71360 sem1 = sem(sem.mod, sem.mod.cov, N=29) stdCoef(sem1) n2S n2S 0.97643950 All...
2013 Jul 22
1
Error with sem function df = -6
...dom being negative "Error in sem.default(ram, S = S, N = N, raw = raw, data = data, pattern.number = pattern.number, : The model has negative degrees of freedom = -6" Can someone explain this error or tell me what is wrong with my model? Thank you. Here is the code: model.ram1 <- specifyModel() UNIT -> Y1, ty,0.3 UNIT -> Z1, tz1,-0.1 UNIT -> Z2, tz2,0.1 CF -> Y1, lamy,0.5 CF -> Z1, lamz1,0.85 CF -> Z2, lamz2,0.2 UNIT -> CF, k Y1 <-> Y1, psi3, NA Z1 <-> Z1, psi1, NA Z2 <-> Z2, psi2, NA CF <-> CF,vCF1,NA sem.m1<-sem(model=model.ram1,S=S2,N=...
2013 Mar 18
1
"save scores" from sem
...be relatively easily done by multiplication the manifest variable vector with the estimates for the specific effect. To make an example: v1; v2; v3; v4 are manifest variables that loads on one y latent variablein a data frame called "A" the code for the model should be like: model <-specifymodel( y -> v1, lam1, NA y -> v2, lam2, NA y -> v3, lam3, NA y -> v4, lam4, NA After fitting the model with sem model.sem <- sem(model, data=A) you should be able to compute the y variable like: attach(data) data$y<-v1*lam1+v2*lam2+v3*lam3+v4*lam4 #change the loading name with the a...
2012 Aug 30
1
path analysis help
...However, I don't figure out a way to construct the model for the path diagram as Fig. 1. in Huang et al. (2002)[1]. I try the following code: huang.cor <- readMoments(diag=FALSE, names=c('x1', 'x2', 'x3', 'y')) 0.76 0.91 0.72 0.94 0.77 0.83 huang.mod <- specifyModel() x1 -> y, p1 x2 -> y, p2 x3 -> y, p3 x1 -> x2, p12 x2 -> x1, p21 x2 -> x3, p23 x3 -> x2, p32 x1 -> x3, p13 x3 -> x1, p31 huang.sem <- sem(huang.mod, huang.cor, 100)# 100 is arbitarious. It give the error message: Error in sem.default(ram, S = S, N = N, raw = raw, d...
2012 Nov 04
1
structural equations using sem package
Hello I am using sem to look at the direct effect of one variable on another but i am uncertain if i am progressing correctly. An example: covar1<-? matrix(c(0.4,-0.2,3,-0.2 , 0.3,-2 , 3 ,-2 , 60), nrow=3,byrow=T) rownames(covar1)<-colnames(covar1)<-c("endo","exo","med") path1<-matrix(c(? ? "exo -> endo",? "g1", NA,
2012 Mar 12
1
SEM eigen value error 0 X 0 matrix
...omponents, but has a whole bunch of 'NA' values listed after my components. I have no idea why they are listed there because I omitted all of the 'NA' values from my data and can verify this by a visual inspection. Here is my specified model: # Primary model wellbeing.model <- specifyModel() belonging -> optimism, path1 autonomy -> optimism, path2 optimism -> wellbeing, path3 belonging -> belonging_hapmar, patha belonging -> belonging_attend, pathb belonging -> belonging_cowrkint, pathc autonomy -> autonomy_overwork, pathd autonomy -> autonomy_famwkoff, pathe...
2012 Aug 08
0
Testing for a second order factor using SEM package
Hi! The following model specification works when testing for first order factors, but when I attempt to test for a second order factor by adding the last 4 lines in the model, I get the error message below: model.cfa.ru <- specifyModel() sRU1 <- sRU, NA, 1 sRU2 <- sRU, lam12 sRU3 <- sRU, lam13 sRU4 <- sRU, lam14 sRU5 <- sRU, lam15 sRU6 <- sRU, lam16 sRU <-> sRU, mak1 sRU1 <-> sRU2, cors1 sRU5 <-> sRU3, cors2 sRU6 <-> sRU2, cors3 sRU6 <-> sRU1, cors4 pRU1 <- pRU, sfsf pRU2 <- p...
2013 Apr 28
0
hierarchical confirmatory factor analysis with sem package
...s = c("NNFI", "CFI", "RMSEA")) : coefficient covariances cannot be computed". I have run CFA before with no issues. This is the first time I am running a nested model. Any help will be greatly appreciated. Regards, Mat cov.matrix<-cov(na.omit(df)) cfa.model<-specifyModel() F1->i2,a1 F1->i3,a2 F1->i4,a3 F1->i11,a4 F1->i12,a5 F1->i15,a6 F1->i18,a7 F2->i6,b1 F2->i7,b2 F2->i8,b3 F2->i13,b4 F2->i20,b5 F3->F1,c1 F3->F2,c2 F4->i1,d1 F4->i5,d2 F4->i9,d3 F4->i10,d4 F4->i14,d5 F4->i16,d6 F4->i17,d7 F4->i19,d8...
2012 Mar 23
0
Fixing error variance in a path analysis to model measurement error in scales using sem package
...g the error variance of each parcel: (1−α(parcel))×variance(parcel), such that α refers to Cronbach's alpha, which is a measure of reliability. What follows is the following path analysis model in theory (i.e., in practice the formulas are replaced with actual numbers): path.inf.final <- specifyModel() pRU -> sRU, test1 pRU -> rRU, test2 sRU -> rRU, test3 sRU -> power_alt, gam1 pRU -> power_alt, gam2 rRU -> power_alt, gam3 sRU -> ms_alt, gam7 pRU -> ms_alt, gam8 rRU -> ms_alt, gam9 sRU <-> sRU, NA, (1 - alpha(sRU))*(variance(sRU)) pRU <-> pRU, NA, (1 - al...
2012 Jan 11
0
Error in charToDate(x)
...(x) volatility(OHLC(x),calc="garman")[,1] myEMA10 <- function(x) EMA(Cl(x),n=10)[,1] myEMA20 <- function(x) EMA(Cl(x),n=20)[,1] myEMA30 <- function(x) EMA(Cl(x),n=30)[,1] myEMA50 <- function(x) EMA(Cl(x),n=50)[,1] myEMA60 <- function(x) EMA(Cl(x),n=60)[,1] data.model <- specifyModel(Delt(Cl(EURUSD)) ~ myATR(EURUSD) + mySMI(EURUSD) + myADX(EURUSD) + myAroon(EURUSD) + myBB(EURUSD) + myChaikinVol(EURUSD) + myCLV(EURUSD) +myEMA10(EURUSD) +myEMA20(EURUSD) +myEMA30(EURUSD) +myEMA50(EURUSD) + myEMA60(EURUSD) + CMO(Cl(EURUSD)) + EMA(Delt(Cl(EURUSD))) + myVolat(EURUSD) + myMACD(EURUSD)...
2011 Nov 24
0
sem package (version 2.1-1)
...ion = lam31*F1 First.Letters = lam42*F2 4.Letter.Words = lam52*F2 Suffixes = lam62*F2 Letter.Series = lam73*F3 Pedigrees = lam83*F3 Letter.Group = lam93*F3 V(F1) = 1 V(F2) = 1 V(F3) = 1 cfa.thur.e <- sem(mod.cfa.thur.e, R.thur, 213) summary(cfa.thur.e) (3) in path format: mod.cfa.thur.p <- specifyModel(covs="F1, F2, F3") F1 -> Sentences, lam11 F1 -> Vocabulary, lam21 F1 -> Sent.Completion, lam31 F2 -> First.Letters, lam41 F2 -> 4.Letter.Words, lam52 F2 -> Suffixes,...
2011 Nov 24
0
sem package (version 2.1-1)
...ion = lam31*F1 First.Letters = lam42*F2 4.Letter.Words = lam52*F2 Suffixes = lam62*F2 Letter.Series = lam73*F3 Pedigrees = lam83*F3 Letter.Group = lam93*F3 V(F1) = 1 V(F2) = 1 V(F3) = 1 cfa.thur.e <- sem(mod.cfa.thur.e, R.thur, 213) summary(cfa.thur.e) (3) in path format: mod.cfa.thur.p <- specifyModel(covs="F1, F2, F3") F1 -> Sentences, lam11 F1 -> Vocabulary, lam21 F1 -> Sent.Completion, lam31 F2 -> First.Letters, lam41 F2 -> 4.Letter.Words, lam52 F2 -> Suffixes,...
2013 Mar 12
1
Bootstrap BCa confidence limits with your own resamples
I like to bootstrap regression models, saving the entire set of bootstrapped regression coefficients for later use so that I can get confidence limits for a whole set of contrasts derived from the coefficients. I'm finding that ordinary bootstrap percentile confidence limits can provide poor coverage for odds ratios for binary logistic models with small N. So I'm exploring BCa confidence
2013 Mar 18
2
Confirmatory factor analysis using the sem package. TLI CFI and RMSEA absent from model summary.
...-307L)) ## data set included using dump() command. Note that there is no missing data here as small amounts of na data have been replaced using linear interpolation. cov.validation <- cov(validation.data) ## covariance matrix to be used as the S argument in sem function cfa.validation <- specifyModel() ## copy and paste this command separately into R before copying the model ABILITY -> V12, ability0 ABILITY -> V9, ability1 ABILITY -> V14, ability2 ABILITY -> V13, ability3 ABILITY -> V3, ability4 ABILITY -> V1, ability5 ABILITY -> V15, ability6 ABILITY -> V10, abil...