Extended Cox model and cox.zph I have previously had experience only with Cox PH model and its assumptions checking.
Now for the first time I have my clients data with most of the covariates varying in time, only a few are fixed valued. I did set it up in start/stop format and I have also fitted some models, but cox.zph is showing very small p-values. My understanding is, that extended Cox model is not a PH model. Do I even need the cox.zph test for time-dependent variables? Or when including fixed covariates, then would I need to see large p-values for those or not? 
 A: This question deserves a more up-to-date answer on a few accounts. First, the cox.zph() function has substantially changed with recent versions of the survival package, so there might be confusion with outputs not looking the same. Second, there can be some hidden "gotchas" when you are dealing with time-dependent covariates, as in this question. Third, although much of another answer is fine, there may be a serious error in one of the proposed ways to specify time-dependent coefficients. Finally, the proper way to deal with that last problem makes it impossible (currently, at least) to use cox.zph() to check proportional hazards (PH) in the final model.

*

*For many years the cox.zph() function performed its tests of PH with an approximation, the correlation coefficient between scaled Schoenfeld residuals and (possibly transformed) time. That correlation coefficient was reported as "rho", as shown in another answer. Since Version 3.0-10 of the package, cox.zph() is now an exact score test. There is no longer a value of "rho" to report.


*With time-dependent covariates there can be a problem with causality. For example, I recently helped analyze some data in which patients' use of a drug prescribed for chronic conditions was included as a covariate. As people get older they are increasingly likely to be using that drug. To include that drug as a time-dependent covariate would be problematic, as it might just be a marker of already having survived longer. A time-dependent covariate can too easily be a proxy for longer survival, which (in addition to the causality problem) might show up as a PH problem. I suspect that might have been part of the problem in the initial question here. To quote from the time-dependent vignette by Therneau, Crowson and Atkinson:

The key rule for time dependent covariates in a Cox model is simple and essentially the same as that for gambling: you cannot look into the future.



*Time-dependent coefficients can help with PH problems whether or not there are time-dependent covariates. Modeling coefficients with step functions as a function of time, one of the approaches proposed in another answer, is valid. As @bandwagoner notes in a comment on that question, the other proposed approach,  a covariate-time interaction, might not be.* Quoting again from the vignette:


This mistake has been made often enough th[at] the coxph routine has been updated to print an error message for such attempts. The issue is that the above code does not actually create a time dependent covariate, rather it creates a time-static value for each subject based on their value for the covariate time; no differently than if we had constructed the variable outside of a coxph call. This variable most definitely breaks the rule about not looking into the future, and one would quickly find the circularity: large values of time appear to predict long survival because long survival leads to large values for time.



*The survival package provides a correct way to specify coefficients as arbitrary functions of time, through a user-defined tt() function. Unfortunately, as the NEWS file for the package says, from version 3.1-2 "The cox.zph command now refuses models with tt() terms, before it had an incorrect computation." So for now it seems that evaluation of time-dependent coefficients will depend on how well the user-defined tt() function matches the form of the time-dependency seen with the time-independent coefficients and on other graphical evaluations.


*The answer from Yuval Spiegler doesn't specify the full nature of the data preparation. If it's done with something like the unfold() function used by Fox and Weisberg, then you have one separate stop, start, event line for each individual for each at-risk time. With that format, the design matrix will contain a current covariate:time interaction value for all individuals at risk at any event time. If the other answer used data prepared that way, then the analysis with the explicit covariate:time interaction term would be OK. The start, stop, event data produced by the tmerge() function used by the survival package time-dependent vignette doesn't produce separate rows for each at-risk time; it breaks up data for an individual into full periods having constant covariate values. With that (much shorter) data format you have to use the tt() functionality to specify a covariate:time interaction correctly.
