design analysis with structurally missing individual covs

posts related to the RMark library, which may not be of general interest to users of 'classic' MARK

design analysis with structurally missing individual covs

Postby Mnat » Wed Nov 03, 2021 11:14 am

This is a question regarding the design but also how to realize this in Rmark:

Besides other variables (colony size, different weather parameters and so on...), body size is a highly important variable in my study, because we want to show that larger individuals have higher survival probabilities. I first have to give a few details about some tricky facts in my data which are important for the size issue:


-Survival for the first interval (if a juvenile becomes adult) is much lower than survival of adults. So I really need to include an age_class factor (juvenile / adult) in my model
-I've got individuals marked as adults and individuals marked as juveniles (but thats fine, I manage to deal with that in Rmark)
-Most important: we only have size values of individuals that survived their first hibernation or were marked as adults, so no size values for individuals that died as juveniles.
-Unfortunately even for some adult individuals the body size is not available.

So it's obvious, that we can only show the effect of size on adult survival with our data. theoretically.
The model that I see in my dreams more or less looks like

Phi (ageclass + weather + size:adults ) p (...)

or maybe

Phi (ageclass*weather + size:adults ) p (...)

However, I'm not sure if this is possible at all. Because if I use "age class" (juvenile vs. adult) then I automatically introduce data that have NAs for size because individuals that died as juveniles don't have size measurements.

My four ideas for the solution are:

1. like suggested in section 11.6 of the Mark book, I could standardize size values and set each missing value to 0. Unfortunately that would be many zeros and I think I would loose too much power.

2. I could do two analyses. One with all individuals but without the variable size. I would mainly focus on interactions between age class and the other tested variables to check what makes the difference for survival between juvs and adults. And in the second analysis I would use a subset of my data with only individuals that have size values (adults) and test all variables again and see if size is in the favourite models. But I'm not sure if this would make sense as a whole. Maybe it's completely rubbish.

3. In the markbook section 11.6. it's also suggested to code the animals into two groups, apply the common parameters to all and the individual cov only to one group. That sounds exactly like what I need :idea: :D . Unfortunately, I don't have a clue how it should work in practice. :shock: I created two new groups. One group for all individuals (nocov) that I filled completely with ones. And another group (cov) where all individuals with size values have a 1 and all without size a 0. However, I'm sorry, I have no Idea how to fit a model where all variables (but not size) are estimated with the data of all individuals and size only with individuals with cov=1. No matter what I do, I get the message
Code: Select all
Error in make.mark.model(data.proc, title = title, parameters = model.parameters,  :
  The following individual covariates are not allowed because they contain NA:  size


4 My last trial was to throw out all adult individuals that have no size mesurements but keep the juveniles that died as juveniles. Means: I only have juveniles with missing size values, but all adults have size values. Inspired by section C15 in the Rmark appendix, I created a dummy variable for each age class and tried for phi ~-1+adult:size. But it didn't worked out.

Please, can someone give me a hint how to figure out this problem?
Mnat
 
Posts: 18
Joined: Wed Apr 10, 2019 4:28 am

Re: design analysis with structurally missing individual cov

Postby jlaake » Wed Nov 03, 2021 4:45 pm

This is mostly an RMark question, so I'll answer and maybe Evan will move there. There is NO capability for missing values in MARK and you cannot have NA values in the covariate. The solution you are considering is close for handling size with adults. First, compute the mean size of adults and subtract it off of the size values you have measured. Then for all NA values set them to 0. For adults those with missing values will now be replaced with the mean which is zero after subtracting the mean off of the measured sizes. Then if you have a variable adult that is 1 for adults and 0 for juveniles, you can then use adult:size in your model. It will limit use of the size variable to adults and the values for juveniles don't really matter but they cannot be an NA.
jlaake
 
Posts: 1479
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA

Re: design analysis with structurally missing individual cov

Postby Mnat » Thu Nov 04, 2021 4:54 am

great, that works!
Now nothing can stop me :twisted:
Thank you
Mnat
 
Posts: 18
Joined: Wed Apr 10, 2019 4:28 am

Re: design analysis with structurally missing individual cov

Postby kquail » Thu May 01, 2025 12:03 pm

Then if you have a variable adult that is 1 for adults and 0 for juveniles, you can then use adult:size in your model. It will limit use of the size variable to adults and the values for juveniles don't really matter but they cannot be an NA.


I am using this example to deal with my own similar situation where I want to include a continuous covariate that is only applicable to immature individuals (not juveniles or adults), and some of the immature individuals have missing values. I have standardized the covariate as jlaake suggested, but I have a follow up question about how to format the 'adult' column in that case (or for me it will be called 'immature'). Is this a separate column with '0' for non-immature individuals and '1' for immatures? If yes, should this be coded as a factor or numeric in RMark?
If a factor, no models that include my parameter, immature:exposure, are included in the final model output (though no errors are thrown). If numeric, models with that parameter are included in the final model set, but I am given a mean value for "immature" of 0.53 as if it is a number variable and not a dummy variable used to indicate which individuals to include with the exposure covariate. I do get a beta estimate for immature:exposure. I just wanted to make sure that RMark/Mark is seeing this covariate as I intend. Here is an example model with that covariate:
Code: Select all
S.Treatment.Time.Exp=list(formula=~FED+time+immature:exposure)


Thank you in advance.
kquail
 
Posts: 16
Joined: Wed Jan 15, 2025 4:15 pm

Re: design analysis with structurally missing individual cov

Postby jlaake » Thu May 01, 2025 7:53 pm

It must be numeric or it doesn't make sense. When it is 0 it puts 0 in the design matrix which eliminates that effect for that condition ( non immature in your case). When it is 1 it puts the covariate in the design matrix. Wasn't said in the post but you construct that 0/1 variable with the age or Age variables and not a group variable such that as the animal ages, the effect phases out when it is no longer defined as immature. Presumably you have defined these age defined variables in your design data. By looking at the design matrix in the resulting mark model object you can see how it included the formula variables.

MARK uses the mean covariate value when reporting real values. You can compute for any range of covariate values by computing manually with the beta value and covariate values or you can use covariate.predictions function.
jlaake
 
Posts: 1479
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA

Re: design analysis with structurally missing individual cov

Postby kquail » Tue May 06, 2025 4:57 pm

Wasn't said in the post but you construct that 0/1 variable with the age or Age variables and not a group variable such that as the animal ages...


Ahh, this is exactly what I was doing incorrectly. Now I have created the immature 0/1 variable within the ddl instead of in the original dataframe. Of course it makes sense to do it this way so that it can change when the animal is no longer immature. Thanks!
kquail
 
Posts: 16
Joined: Wed Jan 15, 2025 4:15 pm


Return to RMark

Who is online

Users browsing this forum: Google [Bot] and 1 guest