lizzieinvancouver / ospree

Budbreak review paper database
3 stars 0 forks source link

do some debugging on new phylo Stan model #388

Closed lizzieinvancouver closed 3 years ago

lizzieinvancouver commented 4 years ago

@FaithJones (backed up by @cchambe12) Check out Phylo_ospree_reanalyses_inprogress.R and these lines in particular:

# This model uses Will's new method, but it is not running, argh!
testme5 <- stan("stan/nointer_2levelphynew_force.stan",
                data=list(N=nrow(d), n_sp=nspecies, sp=d$sppnum,
                force=d$force.z, 
                y=d$resp,
                Vphy=vcv(phylo)),
                iter=3000, chains=1)

Compare code in stan/nointer_2levelphynew_force.stan to (pmm repo) ubermini_2.stan and see if I screwed anything up, did not think through priors etc..

Again, don't spend too long on this! But do some checks to see if we can figure out what might be up.

FaithJones commented 4 years ago

I have taken a look at this problem, and am playing about with ncp parameterisation. One possible issue I have seen that might be contributing is that a_sp and sigma_y were not well defined (no priors). I tried adding some possibly sensible priors (to a file named nointer_2levelphynew_force.stan_fj for now), but no luck.

I also looked around the internet and it seems like the problem might be fixed using ncp methods? The error " LDLT_Factor of covariance parameter is not positive definite" is I think trying to tell you that the matrix calculation can't be done. This problem can arise I think if the different parameters are too different? I tried a bit to get ncp working but I don't quite understand the model well enough at this point in time.

Another idea is maybe the addition of the a_sp parameter is the problem? it doesn't feature in ubermini_2.stan, so maybe it is already been accounted for in the mysterious lambda_vcv matrix?

lizzieinvancouver commented 4 years ago

Notes from @MoralesCastilla today:

I’ve been working on Will’s code and still have not managed to make it run. The things I’ve been trying so far (so if Dan you do some work on this later don’t repeat these):

I still have not tried chilling, so perhaps if Dan (or other) works on this later can try it. I plan on keep trying by:

lizzieinvancouver commented 4 years ago

@AileneKane Also worked on this ... My start on comparing simulated data to ospree data for the phylogeny model is here in phylogeny/compare_ospreedat_ubermini_2.R

And here is a plot (side note, love the salmon and light blue). So we should adjust the test data to: y range is bigger in OSPREE x data is + and - values (in OSPRE) also add more species (and uneven representation)...

In making m=-0.4 in the test data I recreated the initialization issue and we have two PMM issues on this now, see issue 11 and issue 12

lizzieinvancouver commented 3 years ago

We now have a working PMM model! @legault set up initial conditions to fix one of the issues here; otherwise some tweaks to the priors seemed to get the code running. Yay! A lot of the work happened in the pmm repo.