similar to: bug: code not working as expected (PR#8783)

Displaying 20 results from an estimated 9000 matches similar to: "bug: code not working as expected (PR#8783)"

2011 Oct 01
4
Is the output of survfit.coxph survival or baseline survival?
Dear all, I am confused with the output of survfit.coxph. Someone said that the survival given by summary(survfit.coxph) is the baseline survival S_0, but some said that is the survival S=S_0^exp{beta*x}. Which one is correct? By the way, if I use "newdata=" in the survfit, does that mean the survival is estimated by the value of covariates in the new data frame? Thank you very much!
2012 Aug 22
2
log-normal distribution fitting with expected value = 1
Dear R users, I would like to estimate mu and sigma of a log-normal distribution, where I know that the expected value is 1, as it is a normalized distribution. That means as E(x) = exp (mu + 1/2*sigma^2) = 1 that 2*mu = -sigma^2 . Therefore I only need to fit one parameter either sigma or mu. How could I do this in R? Thank you very much for your help! biophil [[alternative HTML version
2010 Jan 28
1
AFT-model with time-varying covariates and left-truncation
Dear Prof. Brostr?m, Dear R-mailinglist, first of all thanks a lot for your great effort to incorporate time-varying covariates into aftreg. It works like a charm so far and I'll update you with detailled benchmarks as soon as I have them. I have one more questions regarding Accelerated Failure Time models (with aftreg): You mention that left truncation in combination with time-varying
2011 Jul 27
2
plotting the ending point in a for loop
Hello, I would appreciate if someone could help me with this query. I would like to plot a line chart of all of the points in a "for" loop. I would also like to plot the final point with a symbol (to show where the random walk ends). Here is the code I am using: Brownian.fn <- function(mu, sigma, T, N){ dt <- T/N t <- c(rep(NA, N)) B1 <- c(rep(NA, N)) B2 <- c(rep(NA,
2009 Feb 25
3
survival::survfit,plot.survfit
I am confused when trying the function survfit. my question is: what does the survival curve given by plot.survfit mean? is it the survival curve with different covariates at different points? or just the baseline survival curve? for example, I run the following code and get the survival curve #### library(survival) fit<-coxph(Surv(futime,fustat)~resid.ds+rx+ecog.ps,data=ovarian)
2017 Nov 01
3
repeat a function
I want to populate the matrix prb through the function HWMProb <- function (a,j,dt) that encapsulates different functions (please see code below), using j= 0:2 for each j. It only populates prb if I specify each function independently in the global environment and then run the loop with the iF statement, as per below. for (j in 0:2) { if (j==0) { prb["0","1"] <-
2011 Oct 06
1
non-cumulative hazard in Cox model with time-dependent covariates
Dear all, Is there a way to calculate the non-cumulative hazard (instantaneous hazard), which is the product of baseline hazard and exp{beta*covariate} ? I knew in survfit, we can get the estimator of cumulative baseline hazard, but how can we get the non-cumulative one? Thank you very much! Koshihaku -- View this message in context:
2017 Nov 02
0
repeat a function
Hi Eric I did not see any answer and frankly speaking I cannot provide you with canned help. AFAIK if a function is defined within another function (which is your case) it cannot be called directly so it is necessary to define it in global environment. > fff <- function(x) { + myf <- function(a) a+2 + myf(x)^2} > > fff(5) [1] 49 > myf(5) Error in myf(5) : could not find
2010 Jul 09
3
apply is slower than for loop?
I thought the "apply" functions are faster than for loops, but my most recent test shows that apply actually takes a significantly longer than a for loop. Am I missing something? It doesn't matter much if I do column wise calculations rather than row wise ## Example of how apply is SLOWER than for loop: #rm(list=ls()) ## DEFINE VARIABLES mu=0.05 ; sigma=0.20 ; dt=.25 ; T=50 ;
2002 Feb 20
2
How to get the penalized log likelihood from smooth.spline()?
I use smooth.spline(x, y) in package modreg and I would like to get value of penalized log likelihood and preferable also its two parts. To make clear what I am asking for (and make sure that I am asking for the right thing) I clarify my problem trying to use the same notation as in help(smooth.spline): I want to find the natural cubic spline f(x) such that L(f) = \sum_{k=1}{n} w[k](y[k] -
2017 Nov 02
2
repeat a function
Hi Petr, Many thanks for your response. Basically I want to create a probability matrix to be used in a trinomial tree going forward. This is the reason why I thought to build the matrix around 0 would be much more efficient. I need to loop through because the probabilities will depend on my node and is not always the same per row (e.g. if N> jmax, jmax being defined in another function) I
2011 Dec 17
2
Problem with reproducing log likelihood estimated with ghyp package
I was playing around with the ghyp package and simulated series of t-distributed variables when suddenly i was not able to reproduce the log likelihood values reported by the package. When trying to reproduce the likelihood values, I summed the log(dt(x,v)) values and it worked with some simulated series but not all. Is there any obvious flaws with this script? library("ghyp")
2006 Aug 04
2
Doubt about Student t distribution simulation
Dear R list, I would like to illustrate the origin of the Student t distribution using R. So, if (sample.mean - pop.mean) / standard.error(sample.mean) has t distribution with (sample.size - 1) degree free, what is wrong with the simulation below? I think that the theoretical curve should agree with the relative frequencies of the t values calculated: #== begin options===== # parameters
2003 Dec 02
2
model of fish over exploitation
Dear all, I have a serious problem to solve my model. I study over exploitation of fish in the bay of biscay (france). I know only the level of catch and the fishing effort (see data below) by year. My model is composed by the following equations: * the growth function Gt(St) = r*St*(1-St/sbar) with Gt the growth of each period t r intrinsec growth of the stock sbar carriyng capacity of the
2001 Nov 29
1
errors in help("TDist")?
Dear all, The help page on the t distribution says: The most used applications are power calculations for t-tests: Let T= (mX - m0) / (S/sqrt(n)) where mX is the `mean' and S the sample standard deviation (`sd') of X_1,X_2,...,X_n which are i.i.d. N(mu,sigma^2). Then T is distributed as non-centrally t with `df'= n-1 degrees of freedom and non-centrality
2020 May 05
1
Use of MathJax (or something similar) in .Rd files
Hi All, After some tinkering, and with support from Duncan, I put together a package that allows for easy inclusion of MathJax equations in Rd files. The package has been submitted to CRAN, but those who want to try this out already can get it here: https://github.com/wviechtb/mathjaxr or in other words: install.packages("remotes")
2017 Nov 03
0
repeat a function
Hi Well, I am not an expert in this field so I cannot comment your approach. I wanted only to point out that building matrix your way is like scratching your left ear with right hand, especially in R. What if you want increase size of your matrix? E.g. you use function ProbUP once for row "0" and than for rows different from jmax (if I correctly understand your code). Use of any
2013 Jan 07
3
multiple versions of function
dear R experts: I want to define a function the calculates the black-scholes value. it takes 5 named parameters, BS <- function(S,K,dt,rf,sigma) {} . let's presume I want to be able to call this not only with my 5 numeric vectors BS( sigma=0.3, S=100, K=100, dt=1, rf=0.1 ) and BS( 100, 100, 1, 0.1, 0.3), but also with a data frame that contains the variables alll in a neat data frame
2011 Nov 06
1
Double integration using R
Hi, I have a function that I need to do double integration: \int^T_0 \int^t_0 N(\delta / \sigma \sqrt(u)) (1-N(\delta / \sigma \sqrt(u))) du dt where N(x) is a standard normal probability of x. I start off by writing an inner integral into a function. Meaning \int^t_0 N(\delta,\sigma \sqrt(u)) (1-N(\delta,\sigma \sqrt(u))) du. Then calling integrate function on this function. This
2009 Dec 16
1
Baseline survival estimate
Dear R-help, I am trying to obtain the baseline survival estimate of a fitted Cox model (S_0 (t)). I know that previous posts have said use 'basehaz' but this gives the baseline hazard function and not the baseline survival estimate. Is there a way to obtain the baseline survival estimate or do I have to use the formula which does something like S(t) = exp[- the integral from 0 to t of