Extract P(>|z|) values from s4 class and write to data.frame

37 views
Skip to first unread message

Chris Paight

unread,
Apr 20, 2020, 4:20:10 PM4/20/20
to unmarked
Hello
I am trying to write p values for my models written to a data.frame.

ark <- unmarkedFrameOccu(y=i, siteCovs = cov)

mbatch1 <- occu(~1 ~1, data=ark)

summary(mbatch1) #gives the following output
Call:
occu(formula = ~1 ~ 1, data = ark)

Occupancy (logit-scale):
 Estimate   SE    z P(>|z|)
      2.1 1.08 1.95  0.0516

Detection (logit-scale):
 Estimate    SE    z P(>|z|)
    0.928 0.359 2.58 0.00982

AIC: 56.65071
Number of sites: 9
optim convergence code: 0
optim iterations: 17
Bootstrap iterations: 0

str(summary(mbatch)) #gives more detail
Call:
occu(formula = ~1 ~ 1, data = ark)

Occupancy (logit-scale):
 Estimate   SE    z P(>|z|)
      2.1 1.08 1.95  0.0516

Detection (logit-scale):
 Estimate    SE    z P(>|z|)
    0.928 0.359 2.58 0.00982

AIC: 56.65071
Number of sites: 9
optim convergence code: 0
optim iterations: 17
Bootstrap iterations: 0

List of 2
 $ state:'data.frame':    1 obs. of  4 variables:
  ..$ Estimate: num 2.1
  ..$ SE      : num 1.08
  ..$ z       : num 1.95
  ..$ P(>|z|) : num 0.0516
 $ det  :'data.frame':    1 obs. of  4 variables:
  ..$ Estimate: num 0.928
  ..$ SE      : num 0.359
  ..$ z       : num 2.58
  ..$ P(>|z|) : num 0.00982

y <- mbatch@estimates[["state"]]#at the moment i just want the state p value

str(summary(y))
Occupancy (logit-scale):
 Estimate   SE    z P(>|z|)
      2.1 1.08 1.95  0.0516
'data.frame':    1 obs. of  4 variables:
 $ Estimate: num 2.1
 $ SE      : num 1.08
 $ z       : num 1.95
 $ P(>|z|) : num 0.0516

I have not been able to call $ state:'data.frame': to separate it out into an independent data frame.  The information is there I just can't call it with @ or $.
Does anyone have in insights into how I would do this I have reached the end of my R knowledge. Thanks in advance.
Cheers Chris

Richard Chandler

unread,
Apr 20, 2020, 4:24:30 PM4/20/20
to unma...@googlegroups.com

Hi Chris,

 

Try this:

 

s <- summary(mbatch1)

s$state$P

 

 

Best,

Richard

 

 

 

--

Richard Chandler

Associate Professor

Wildlife Ecology and Conservation

Warnell School of Forestry and Natural Resources

University of Georgia

http://chandlerlab.uga.edu/

 

From: Chris Paight
Sent: Monday, April 20, 2020 4:20 PM
To: unmarked
Subject: [unmarked] Extract P(>|z|) values from s4 class and write to data.frame

 

[EXTERNAL SENDER - PROCEED CAUTIOUSLY]

--
You received this message because you are subscribed to the Google Groups "unmarked" group.
To unsubscribe from this group and stop receiving emails from it, send an email to unmarked+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/unmarked/5450131f-ec12-49b6-9d2a-08b88256e276%40googlegroups.com.

 

Chris Paight

unread,
Apr 20, 2020, 4:30:13 PM4/20/20
to unmarked
Hi Richard
yup that's it simple, clean, beautiful. Thank you.

To unsubscribe from this group and stop receiving emails from it, send an email to unma...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages