Page 1 of 1

Error message when opening RMark Import

PostPosted: Thu Feb 16, 2017 9:38 pm
by Bryan Hamilton
I'm trying to export models from RMark to Mark to do MCMC estimation using "export.MARK".

I'm able to open CJS models in MARK created with "export.MARK".
Code: Select all
data(dipper)
dipper.processed=process.data(dipper,groups=("sex"))
#
# Create default design data
#
dipper.ddl=make.design.data(dipper.processed)
#
run.dipper=function()
{
  #
  # Process data
  #
  # Add Flood covariates for Phi and p that have different values
  #
  dipper.ddl$Phi$Flood=0
  dipper.ddl$Phi$Flood[dipper.ddl$Phi$time==2 | dipper.ddl$Phi$time==3]=1
  dipper.ddl$p$Flood=0
  dipper.ddl$p$Flood[dipper.ddl$p$time==3]=1
  #
  #  Define range of models for Phi
  #
  Phidot=list(formula=~1)
  Phitime=list(formula=~time)
  Phisex=list(formula=~sex)
  Phisextime=list(formula=~sex+time)
  Phisex.time=list(formula=~sex*time)
  PhiFlood=list(formula=~Flood)
  #
  #  Define range of models for p
  #
  pdot=list(formula=~1)
  ptime=list(formula=~time)
  psex=list(formula=~sex)
  psextime=list(formula=~sex+time)
  psex.time=list(formula=~sex*time)
  pFlood=list(formula=~Flood)
  #
  # Run assortment of models
  #
  dipper.phidot.pdot          =mark(dipper.processed,dipper.ddl,
                                    model.parameters=list(Phi=Phidot,p=pdot))
  dipper.phidot.pFlood         =mark(dipper.processed,dipper.ddl,
                                     model.parameters=list(Phi=Phidot,p=pFlood))
  dipper.phidot.psex           =mark(dipper.processed,dipper.ddl,
                                     model.parameters=list(Phi=Phidot,p=psex))
  dipper.phidot.ptime          =mark(dipper.processed,dipper.ddl,
                                     model.parameters=list(Phi=Phidot,p=ptime))
  #
  # Return model table and list of models
  #
  return(collect.models() )
}

dipper.results=run.dipper()
export.MARK(dipper.processed,"dipper",dipper.results)


and Pradel models exported from RMark open fine in Mark.
Code: Select all
data(dipper)
dipper.processed=process.data(dipper,groups=("sex"), model="Pradel")
summary(dipper.processed)
#
# Create default design data
#
dipper.ddl=make.design.data(dipper.processed)
summary(dipper.ddl)
#
run.dipper=function()
{
  #
  # Process data
  #
  # Add Flood covariates for Gamma and p that have different values
  #
  dipper.ddl$Gamma$Flood=0
  dipper.ddl$Gamma$Flood[dipper.ddl$Gamma$time==2 | dipper.ddl$Gamma$time==3]=1
  dipper.ddl$p$Flood=0
  dipper.ddl$p$Flood[dipper.ddl$p$time==3]=1
  #
  #  Define range of models for Gamma
  #
  Gammadot=list(formula=~1)
  Gammatime=list(formula=~time)
  Gammasex=list(formula=~sex)
  Gammasextime=list(formula=~sex+time)
  Gammasex.time=list(formula=~sex*time)
  GammaFlood=list(formula=~Flood)
  #
  #  Define range of models for p
  #
  pdot=list(formula=~1)
  ptime=list(formula=~time)
  psex=list(formula=~sex)
  psextime=list(formula=~sex+time)
  psex.time=list(formula=~sex*time)
  pFlood=list(formula=~Flood)
  #
  # Run assortment of models
  #
  dipper.Gammadot.pdot          =mark(dipper.processed,dipper.ddl,
                                    model.parameters=list(Gamma=Gammadot,p=pdot))
  dipper.Gammadot.pFlood         =mark(dipper.processed,dipper.ddl,
                                     model.parameters=list(Gamma=Gammadot,p=pFlood))
  dipper.Gammadot.psex           =mark(dipper.processed,dipper.ddl,
                                     model.parameters=list(Gamma=Gammadot,p=psex))
  dipper.Gammadot.ptime          =mark(dipper.processed,dipper.ddl,
                                     model.parameters=list(Gamma=Gammadot,p=ptime))
  #
  # Return model table and list of models
  #
  return(collect.models() )
}

dipper.results=run.dipper()
export.MARK(dipper.processed,"dipper2",dipper.results)


But when I try to open exported Pradel recruitment (Pradrec) models, I get an error message from MARK, "Improper data type specified". Does anyone have ideas on what the problem might be?

Code: Select all
data(dipper)
dipper.processed=process.data(dipper,groups=("sex"), model="Pradrec")
summary(dipper.processed)
#
# Create default design data
#
dipper.ddl=make.design.data(dipper.processed)
summary(dipper.ddl)
#
run.dipper=function()
{
  #
  # Process data
  #
  # Add Flood covariates for f and p that have different values
  #
  dipper.ddl$f$Flood=0
  dipper.ddl$f$Flood[dipper.ddl$f$time==2 | dipper.ddl$f$time==3]=1
  dipper.ddl$p$Flood=0
  dipper.ddl$p$Flood[dipper.ddl$p$time==3]=1
  #
  #  Define range of models for f
  #
  fdot=list(formula=~1)
  ftime=list(formula=~time)
  fsex=list(formula=~sex)
  fsextime=list(formula=~sex+time)
  fsex.time=list(formula=~sex*time)
  fFlood=list(formula=~Flood)
  #
  #  Define range of models for p
  #
  pdot=list(formula=~1)
  ptime=list(formula=~time)
  psex=list(formula=~sex)
  psextime=list(formula=~sex+time)
  psex.time=list(formula=~sex*time)
  pFlood=list(formula=~Flood)
  #
  # Run assortment of models
  #
  dipper.fdot.pdot          =mark(dipper.processed,dipper.ddl,
                                      model.parameters=list(f=fdot,p=pdot))
  dipper.fdot.pFlood         =mark(dipper.processed,dipper.ddl,
                                       model.parameters=list(f=fdot,p=pFlood))
  dipper.fdot.psex           =mark(dipper.processed,dipper.ddl,
                                       model.parameters=list(f=fdot,p=psex))
  dipper.fdot.ptime          =mark(dipper.processed,dipper.ddl,
                                       model.parameters=list(f=fdot,p=ptime))
  #
  # Return model table and list of models
  #
  return(collect.models() )
}

dipper.results=run.dipper()
export.MARK(dipper.processed,"dipper3",dipper.results)

Re: Error message when opening RMark Import

PostPosted: Fri Feb 17, 2017 7:05 pm
by jlaake
Haven't we discussed this before? I think I told you that you would have to send the .Rinp file to Gary to ask for his help. He'll need to see it to work out why it is not importing. It may be an error on my end but I don't have anyway of debugging the problem.

Re: Error message when opening RMark Import

PostPosted: Fri Feb 17, 2017 7:53 pm
by Bryan Hamilton
No we haven't discussed it. I did see a post with a similar error message but the resolution was not posted.

Re: Error message when opening RMark Import

PostPosted: Tue Feb 21, 2017 2:28 pm
by jlaake
Simple problem here. I have model name input as Pradrec and Gary has it as PradRec. Apparently that doesn't stop it from running the model in MARK but does stop it from being imported. This will also affect PradSen and PradLambda as well which have the upper case letter. I'll fix this in next release but for the time being, just edit the .Rinp file and make change to first line containing model name.