[R] Probit Analysis
apjaworski@mmm.com
apjaworski at mmm.com
Wed Jan 1 01:38:02 CET 2003
Jacquelin,
Here is an answer to your question wrapped in much longer question of my
own.
Cheers,
Andy
-----------------------------------------------------------------------------------------
Extracting components from complex objects is, in my opinion, not easy to
do unless I am missing something very obvious. Take the glm.dose object as
an example. Following the example on the dose.p help page I ran
zz <- dose.p(budworm.lg0, cf = c(1,3), p = 1:3/4)
Typing zz applies print method to the zz object and shows
Dose SE
p = 0.25: 2.231264 0.2498235
p = 0.50: 3.263587 0.2297039
p = 0.75: 4.295910 0.2746190
If I now want to extract some of the numbers from zz, I have to go through
some hoops. What I usually do first is
str(zz)
This gives me
Class 'glm.dose' atomic [1:3] 2.23 3.26 4.30
..- attr(*, "SE")= num [1:3, 1] 0.250 0.230 0.275
.. ..- attr(*, "dimnames")=List of 2
.. .. ..$ : chr [1:3] "p = 0.25:" "p = 0.50:" "p = 0.75:"
.. .. ..$ : NULL
..- attr(*, "p")= num [1:3] 0.25 0.5 0.75
The format of this output is not really described on the str help page, so
I am guessing that what this means is that the "basic" object is a vector
of length 3 with a couple of attributes called SE and p, the SE attribute
having additional nested attribute called dimnames. We can onfirm that by
attributes(zz)
giving
$names
[1] "p = 0.25:" "p = 0.50:" "p = 0.75:"
$SE
[,1]
p = 0.25: 0.2498235
p = 0.50: 0.2297039
p = 0.75: 0.2746190
$p
[1] 0.25 0.50 0.75
$class
[1] "glm.dose"
So, If I want to extract the actual dose value from zz I just need
zz[1]
geting
p = 0.25:
2.231264
but if I want to get the first standard error I have to do
attributes(zz)$SE[1]
getting
p = 0.25:
0.2498235
Is this a correct general method of extracting components from complex
objects? Is there a simpler way?
Thanks in advance and sorry for this longish post, but this is something I
have been having problems with for a long time and it seems that every time
I run into this "extraction problem" I have to reinvent the wheel.
Andy
__________________________________
Andy Jaworski
Engineering Systems Technology Center
3M Center, 518-1-01
St. Paul, MN 55144-1000
-----
E-mail: apjaworski at mmm.com
Tel: (651) 733-6092
Fax: (651) 736-3122
|---------+---------------------------------->
| | "Ngayee J Law" |
| | <Ngayee.Law at celeradiagn|
| | ostics.com> |
| | |
| | 12/31/2002 17:18 |
| | |
|---------+---------------------------------->
>-----------------------------------------------------------------------------------------------------------------------------|
| |
| To: apjaworski at mmm.com |
| cc: r-help at stat.math.ethz.ch |
| Subject: Re: [R] Probit Analysis |
>-----------------------------------------------------------------------------------------------------------------------------|
Hi Andy,
Thanks! glm and dose.p can do exaclty what I want to do. Just a quick
question,
how can I extract the numbers in the glm.dose object created by the dose.p?
My
goal is to calculate a 95% CI for the 'LD50'.
- Jacqueline
apjaworski at mm
m.com To: "Ngayee J Law"
<Ngayee.Law at celeradiagnostics.com>
cc: r-help at stat.math.ethz.ch
12/31/2002 Subject: Re: [R] Probit
Analysis
02:47 PM
Jacqueline,
This should be a simple application of GLM. Check the help pages for glm,
family and dose.p in library MASS. Look at the example at the bottom of
the dose.p help page - it does almost exactly what you need.
Hope this helps,
Andy
__________________________________
Andy Jaworski
Engineering Systems Technology Center
3M Center, 518-1-01
St. Paul, MN 55144-1000
-----
E-mail: apjaworski at mmm.com
Tel: (651) 733-6092
Fax: (651) 736-3122
|---------+---------------------------------->
| | "Ngayee J Law" |
| | <Ngayee.Law at celeradiagn|
| | ostics.com> |
| | Sent by: |
| | r-help-admin at stat.math.|
| | ethz.ch |
| | |
| | |
| | 12/31/2002 16:17 |
| | |
|---------+---------------------------------->
>
-----------------------------------------------------------------------------------------------------------------------------|
|
|
| To: r-help at stat.math.ethz.ch
|
| cc:
|
| Subject: [R] Probit Analysis
|
>
-----------------------------------------------------------------------------------------------------------------------------|
Hello all,
I have a very simple set of data and I would like to analyze them with
probit analysis.
The data are:
X Event Trial
100 8 8
75 8 8
50 6 8
25 4 8
10 2 8
0 0 8
I want to estimate the value of X that will give a 95% hit rate
(Event/Trial) and the corresponding
95% CI. Anyone can offer some help? Thanks!!
- Jacqueline
______________________________________________
R-help at stat.math.ethz.ch mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help
More information about the R-help
mailing list