2025-01-12 04:36:52 +08:00

77 lines
1.6 KiB
Plaintext

R version 2.12.0 Under development (unstable) (2010-05-21 r52065)
Copyright (C) 2010 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-unknown-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> ## a quick check on vcov for fitdistr (from 7.3-6/7)
>
> library(MASS)
>
> options(digits=4)
> set.seed(1)
> x <- rnorm(100)
> fit <- fitdistr(x, "normal")
> fit
mean sd
0.10889 0.89370
(0.08937) (0.06319)
> vcov(fit)
mean sd
mean 0.007987 0.000000
sd 0.000000 0.003993
>
> x <- rlnorm(100)
> fit <- fitdistr(x, "lognormal")
> fit
meanlog sdlog
-0.03781 0.95308
( 0.09531) ( 0.06739)
> vcov(fit)
meanlog sdlog
meanlog 0.009084 0.000000
sdlog 0.000000 0.004542
>
> x <- rpois(100, 4.5)
> fit <- fitdistr(x, "poisson")
> fit
lambda
4.5400
(0.2131)
> vcov(fit)
lambda
lambda 0.0454
>
> x <- rexp(100, 13)
> fit <- fitdistr(x, "exponential")
> fit
rate
15.224
( 1.522)
> vcov(fit)
rate
rate 2.318
>
> x <- rgeom(100, 0.25)
> fit <- fitdistr(x, "geometric")
> fit
prob
0.22831
(0.02006)
> vcov(fit)
prob
prob 0.0004022
>