adcomp icon indicating copy to clipboard operation
adcomp copied to clipboard

FAQ and questions

Open jlaake opened this issue 9 years ago • 13 comments

I realize that TMB is relatively new but as a beginner it would be nice to know where I can post questions and hope to get a response. I don't want to wear out the same folks with individual questions. Presumably you don't want questions about TMB on the wiki/issues and that seems to be happening. I have signed up for the TMB-Users google groups but it appears I'm the first to post anything other than the Test message. Hopefully this can become an active list and source of information for the community to ask and answer questions and a repository for people to search. I suggest that you add an item under Beginners in the FAQ that suggests where you want folks to post questions - presumably the TMB-Users google group. Maybe this will be the catalyst to get the list moving.

Also, I think the statement in the FAQ that you don't need to know much C++ to use TMB is misleading at the least. Sure the syntax of R is like C and that helps but there is a lot of syntax that isn't R like and there is much that that you need to learn to do anything more than trivial examples. Also it downplays the very real differences between C and R when it comes to things like indexes starting at 0 in C and 1 in R which is buried in one of the tutorials. Also, any R user will come to this package expecting certain indexing and other approaches to work that don't have an equivalence in C or the added classes etc. Also, R is much more forgiving than C++. So please make that statement more realistic.

Finally, many initial TMB users will be migrating from ADMB. A section of the FAQ providing some hints on migration would be very useful. I realize this is a big task and everyone here is volunteering their time. But I'm hoping by posting this we can discuss the idea and I would certainly be willing to help. I have already started to compile a list of problems that I've encountered as a beginning user that could help other beginners avoid them.

I think TMB has the potential to become extremely useful in the R world and much more so than ADMB because TMB can be embedded into R. Also, personally I've run into resistance in the CRAN community to ADMB and particularly when it is embedded into R packages for CRAN. With TMB being on CRAN that problem goes away; however, it would sure be nice if the CRAN folks automatically installed Rtools when R was installed for Windows.

regards --jeff

jlaake avatar Sep 14 '16 00:09 jlaake

@jlaake

The TMB google group seems to be working fine. You are right this is an appropriate place to post questions and I have added a link on the FAQ: TMB Google group

Thanks for working out a migration list for ADMB users. If its a long list it would be great with a separate wiki page. Otherwise please add it to the FAQ under 'For ADMB users'.

I think its fair to say that a deep knowledge of C++ isn't necessary in order to use TMB (given the complexity of the C++ language). If you have a better formulation please feel free to modify :)

kaskr avatar Sep 14 '16 08:09 kaskr

Perfect. Hopefully that will help kickstart the list. Even though it is working it has certainly not been used to date.

I'm far from having a complete migration list from ADMB but I'll do my best to add to the one I have started. I'm still so new with TMB and certainly no expert at ADMB that my attempt may be a bit naive. It is likely to be too long to put in the FAQ.

I'll look at editing the FAQ with regard to statement made about C++. There are enough differences between R and C that I think it leaves the reader with the impression that they can largely get by on their R knowledge. Definitely not true.

I'll contribute the best I can because I think TMB has very real potential to become very useful to the R community and the best way to make that happen is to make it easier for beginners to learn.

jlaake avatar Sep 14 '16 14:09 jlaake

I edited the FAQ. Please check to make sure what I said is correct and you are okay with it. Also, you have a link to a C++ tutorial. Is that the "Getting Started" under modules? If so I'll change the link and make that clear in the FAQ.

I'd like to suggest that you have a Beginners Section at the first page of the Wiki and put the tutorial links and the FAQ link there. I can do that if you are okay with it.

jlaake avatar Sep 14 '16 16:09 jlaake

Hey, I wrote up this list of guidelines for conversion from ADMB to TMB and best practices in TMB about 2 years ago when I was first involved in learning TMB. It may be of some use to you?

The list is not exhaustive and parts may be outdated... Just look and see if any parts are useful. Guide to TMB.docx TMB Tutorial.docx

Also I have a walked through example of linear regression with TMB, which I can also send.

Njoselson avatar Sep 14 '16 16:09 Njoselson

The FAQ looks good now.

The "segment" stuff should be part of http://kaskr.github.io/adcomp/matrix_arrays_8cpp-example.html I will fix that at opportunity.

skaug avatar Sep 14 '16 17:09 skaug

Thanks for the guides. I'll read and merge with what I have and maybe we can post on the wiki in some format.

segment tail and head are great but what is needed is something that allows you to extract any set of values with a vector of indices. What would be nice would be the C++ equivalent to the following R code which I can do in ADMB TPL. I realize I can do this with a loop and could create a function to do it. But I think it would be a nice addition to the language if it doesn't already exist. Maybe a .subset that was say x.subset(ix)

x=1:10 ix=c(1,3,5,7) x[ix]

jlaake avatar Sep 14 '16 20:09 jlaake

Thanks for the guides. I'll read and merge with what I have and maybe we can post on the wiki in some format.

segment tail and head are great but what is needed is something that allows you to extract any set of values with a vector of indices. What would be nice would be the C++ equivalent to the following R code which I can do in ADMB TPL. I realize I can do this with a loop and could create a function to do it. But I think it would be a nice addition to the language if it doesn't already exist. Maybe a .subset that was say x.subset(ix)

x=1:10 ix=c(1,3,5,7) x[ix]

jlaake avatar Sep 14 '16 20:09 jlaake

Thanks for the guides. I'll read and merge with what I have and maybe we can post on the wiki in some format.

segment tail and head are great but what is needed is something that allows you to extract any set of values with a vector of indices. What would be nice would be the C++ equivalent to the following R code which I can do in ADMB TPL. I realize I can do this with a loop and could create a function to do it. But I think it would be a nice addition to the language if it doesn't already exist. Maybe a .subset that was say x.subset(ix)

x=1:10 ix=c(1,3,5,7) x[ix]

jlaake avatar Sep 14 '16 20:09 jlaake

My apologies for the 3x posting. My internet was malfunctioning and it did not appear to be posting.

jlaake avatar Sep 14 '16 20:09 jlaake

It's already possible to do vectorized index subsets. The index vector must be a of type vector<int>. Typical usage is to transfer the index vector as DATA_FACTOR which is automatically zero based. There's one important limitation though: Index subset assignment doesn't work - and you won't get a compile time error. That's why this feature is considered experimental.

kaskr avatar Sep 15 '16 10:09 kaskr

@jlaake Feel free to edit the wiki - it's no problem to roll back if something get messed up.

kaskr avatar Sep 15 '16 10:09 kaskr

Can you please provide or point me to an example of the vectorized index subsets. Every time I tried I got a compile time error which was why I presumed it didn't work but I must have had something incorrect.

jlaake avatar Sep 15 '16 14:09 jlaake

There aren't any (because it's experimental). This should work:

DATA_FACTOR(f);
PARAMETER_VECTOR(p); // Must have length=nlevels(f)
vector<Type> pf = p(f);

kaskr avatar Sep 15 '16 14:09 kaskr