You are here

extracting standard errors (se) from $output

5 posts / 0 new
Last post
tbates's picture
Offline
Joined: 07/31/2009 - 14:25
extracting standard errors (se) from $output

Hi there,
I can't see the SEs in $output... I guess that means they are computed by summary()?
But I also don't see how to extract them programatically from the output of summary(fit)

none of these work:
x = summary(fit)
x$SE; x$standard_error; x$error_estimate

any clues?

mspiegel's picture
Offline
Joined: 07/31/2009 - 15:24
x below is the captured

x below is the captured result of the summary function.

> names(x)
 [1] "parameters"          "estimatedParameters" "observedStatistics" 
 [4] "degreesOfFreedom"    "SaturatedLikelihood" "Minus2LogLikelihood"
 [7] "Chi"                 "p"                   "AIC.Mx"             
[10] "BIC.Mx"              "RMSEA"              
> x$parameters
   name matrix row col parameter estimate error estimate
1        A   1   6         0.39715247    0.010671937
2        A   2   6         0.50366153    0.012602184
3        A   3   6         0.57724183    0.014013832
4        A   4   6         0.70277427    0.016683549
5        A   5   6         0.79625063    0.018601170
6        S   1   1         0.04081422    0.001966350
7        S   2   2         0.03802001    0.001975058
8        S   3   3         0.04082720    0.002205316
9        S   4   4         0.03938708    0.002347691
10       S   5   5         0.03628711    0.002583161
> x$parameters[,'error estimate']
 [1] 0.010671937 0.012602184 0.014013832 0.016683549 0.018601170 0.001966350
 [7] 0.001975058 0.002205316 0.002347691 0.002583161
Steve's picture
Offline
Joined: 07/30/2009 - 14:03
As an aside, in other R

As an aside, in other R parameter summary output tables, the "parameter estimate" column is called "Estimate" and "error estimate" is called "Std.Error".

I think it would be useful to change to these conventions before too many scripts start using the current non-standard names for the parameters.

mspiegel's picture
Offline
Joined: 07/31/2009 - 15:24
Column names changed.

Column names changed.

tbates's picture
Offline
Joined: 07/31/2009 - 14:25
answering own

answering own question:

summary(fit)->x
x$parameters->y
names(y)
y$"error estimate"

y$"parameter estimate"

CI95 = y$"error estimate" *1.96
out = data.frame(cbind(y$"parameter estimate" - CI95,y$"parameter estimate" + CI95))
names(out)<-c("lower95", "upper95")
cbind(y,out)

<

pre>
name matrix row col parameter estimate error estimate lower95 upper95
1 z.a 1 1 0.70073451 0.02057023 0.66041686 0.7410522
2 z.a 2 1 0.24912664 0.02591953 0.19832436 0.2999289
3 z.a 3 1 0.20698145 0.02510899 0.15776784 0.2561951
4 z.a 2 2 0.51334363 0.02391689 0.46646651 0.5602207
5 z.a 3 2 0.14779040 0.03128508 0.08647163 0.2091092
6 z.a 3 3 0.46045070 0.02237860 0.41658864 0.5043128
7 z.e 1 1 0.56046335 0.01486462 0.53132870 0.5895980
8 z.e 2 1 0.09410643 0.02322942 0.04857677 0.1396361
9 z.e 3 1 0.15132024 0.02320856 0.10583146 0.1968090
10 z.e 2 2 0.57513631 0.01714868 0.54152490 0.6087477
11 z.e 3 2 0.23929379 0.02285542 0.19449718 0.2840904
12 z.e 3 3 0.57438104 0.01486940 0.54523701 0.6035251
13 Trait1mean z.expMean 1 1 2.49599883 0.02137079 2.45411208 2.5378856
14 Trait2mean z.expMean 1 2 2.97599306 0.01945248 2.93786620 3.0141199
15 Trait3mean z.expMean 1 3 2.08150033 0.01837959 2.04547632 2.1175243