Message-ID: <x2vf1su8wo.fsf@turmalin.kubism.ku.dk>
Date: 2005-08-26T13:25:59Z
From: Peter Dalgaard
Subject: Matrix oriented computing
In-Reply-To: <1125060924.5528.2.camel@localhost.localdomain>
Marc Schwartz <MSchwartz at mn.rr.com> writes:
> x <- c(0.005, 0.010, 0.025, 0.05, 0.1, 0.5, 0.9,
> 0.95, 0.975, 0.99, 0.995)
>
> df <- c(1:100)
>
> mat <- sapply(x, qchisq, df)
>
> > dim(mat)
> [1] 100 11
>
> > str(mat)
> num [1:100, 1:11] 3.93e-05 1.00e-02 7.17e-02 2.07e-01 4.12e-01 ...
outer() is perhaps a more natural first try... It does give the
transpose of the sapply approach, though.
round(t(outer(x,df,qchisq)),2)
should be close. You should likely add dimnames.
--
O__ ---- Peter Dalgaard ??ster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907