Displaying 20 results from an estimated 900 matches similar to: "HowTo derive a correct likelihood-ratio chi-squared statistic from lrm() with a rsc() ?"
2005 Aug 13
1
Penalized likelihood-ratio chi-squared statistic: L.R. model for Goodness of fit?
Dear R list,
From the lrm() binary logistic model we derived the G2 value or the
likelihood-ratio chi-squared statistic given as L.R. model, in the output of
the lrm().
How can this value be penalized for non-linearity (we used splines in the
lrm function)?
lrm.iRVI <- lrm(arson ~ rcs(iRVI,5),
penalty=list(simple=10,nonlinear=100,nonlinear.interaction=4))
This didn’t work
2005 Apr 15
2
negetative AIC values: How to compare models with negative AIC's
Dear,
When fitting the following model
knots <- 5
lrm.NDWI <- lrm(m.arson ~ rcs(NDWI,knots)
I obtain the following result:
Logistic Regression Model
lrm(formula = m.arson ~ rcs(NDWI, knots))
Frequencies of Responses
0 1
666 35
Obs Max Deriv Model L.R. d.f. P C Dxy
Gamma Tau-a R2 Brier
701 5e-07 34.49
2006 Oct 27
1
(no subject)
Hi,
I have generated a profile likelihood for a parameter (x) and am
trying to get 95% confidence limits by calculating the two points
where the log likelihood (LogL) is 2 units less than the maximum
LogL. I would like to do this by linear interpolation and so I have
been trying to use the function approxfun which allows me to get a
function to calculate LogL for any value of x within
2008 Sep 11
0
Loop for the convergence of shape parameter
Hello,
The likelihood includes two parameters to be estimated: lambda
(=beta0+beta1*x) and alpha. The algorithm for the estimation is as
following:
1) with alpha=0, estimate lambda (estimate beta0 and beta1 via GLM)
2) with lambda, estimate alpha via ML estimation
3) with updataed alpha, replicate 1) and 2) until alpha is converged to a
value
I coded 1) and 2) (it works), but faced some
2005 May 31
1
Solved: linear regression example using MLE using optim()
Thanks to Gabor for setting me right. My code is as follows. I found
it useful for learning optim(), and you might find it similarly
useful. I will be most grateful if you can guide me on how to do this
better. Should one be using optim() or stats4::mle?
set.seed(101) # For replicability
# Setup problem
X <- cbind(1, runif(100))
theta.true <- c(2,3,1)
y <- X
2007 Jun 19
1
Error handling
Hello,
I have a question about error handling. I run simulation studies and often the program stops with an error, for example during maximum likelihood. I would like the program not to stop but to continue and I would like to ask how the error handling can be set up for this (if it can). I tried to look through manuals etc but unfortunately did not get closer to the solution. Below is a
2002 Jul 05
1
radiomatic
Streaming and On-Air Performance for everyone.
2.7.2002 - 6.7.2002, daily 8:00pm - 0:00am
Weimar, Germany, On Air: 106,6 Mhz
http://www.radiostudio.org/streaps
contact: streaps@radiostudio.org
Everybody is welcome to connect with our new online mixing tool STREAPS
<p>RadioMatic is a on-line coop-system initiated by Jerome Joy and Ralf
Homann
between two art schools: Villa Arson in Nice
2008 Dec 31
2
function of mixture normal with covariates
Hello,
My name is Julia and I'm doing my phd on roc analysis.
I'm trying to write a maximization function for the likelihood attached in
the document.
For some reason it's not working I keep getting \this error:
Error: unexpected symbol in:
" +log(v_pred))
return"
> }
Error: unexpected '}' in "}"
>
>
2010 Jul 07
3
Boxplots over a Scatterplot
Hello-
I'm new to R, coding and stats. (Oh no.)
Anyway, I have about 12000 data points in a data.frame (dealing with
dimensions and geological stage information for fossil protists) and have
plotted them in a basic scatter plot. I also added a boxplot to overlay
these points. Each worked fine independently, but when I attempt to
superimpose them with add=true, I get a different scale for
2006 Mar 13
1
Formatting an anova table using latex
Hi r-helpers,
When I issue the command
latex(anova(raw1.lmer0, raw1.lmer, raw1.lmerI), file = 'raw1.tex',
rownamesTexCmd = c('baR', 'addit', 'multip'), longtable = F, dcolumn
= T, booktabs = T, t able.env = F, colheads = NULL, colnamesTexCmd = c
('', 'df', 'aic', 'bic', 'logl', 'chisq', 'chisqdf',
2005 Jun 29
2
MLE with optim
Hello,
I tried to fit a lognormal distribution by using optim. But sadly the output
seems to be incorrect.
Who can tell me where the "bug" is?
test = rlnorm(100,5,3)
logL = function(parm, x,...) -sum(log(dlnorm(x,parm,...)))
start = list(meanlog=5, sdlog=3)
optim(start,logL,x=test)$par
Carsten.
[[alternative HTML version deleted]]
2009 Jul 01
2
Difficulty in calculating MLE through NLM
Hi R-friends,
Attached is the SAS XPORT file that I have imported into R using following code
library(foreign)
mydata<-read.xport("C:\\ctf.xpt")
print(mydata)
I am trying to maximize logL in order to find Maximum Likelihood Estimate (MLE) of 5 parameters (alpha1, beta1, alpha2, beta2, p) using NLM function in R as follows.
# Defining Log likelihood - In the function it is noted as
2011 Dec 01
1
Estimation of AR(1) Model with Markov Switching
Dear R users,
I have been trying to obtain the MLE of the following model
state 0: y_t = 2 + 0.5 * y_{t-1} + e_t
state 1: y_t = 0.5 + 0.9 * y_{t-1} + e_t
where e_t ~ iidN(0,1)
transition probability between states is 0.2
I've generated some fake data and tried to estimate the parameters using the
constrOptim() function but I can't get sensible answers using it. I've tried
using
2009 Nov 05
1
partitioning chi-square statistic (g squared)
hi all -
is there a package or library that contains a function for partitioning the
chi-square statistic of an I X J contingency table into its respective
independent parts?
i looked around for this, but i didn't find anything. perhaps there's
another name for this sort of analysis? i know it as "g-squared".
thanks,
chris.
[[alternative HTML version deleted]]
2008 Aug 12
2
Maximum likelihood estimation
Hello,
I am struggling for some time now to estimate AR(1) process for commodity price time series. I did it in STATA but cannot get a result in R.
The equation I want to estimate is: p(t)=a+b*p(t-1)+error
Using STATA I get 0.92 for a, and 0.73 for b.
Code that I use in R is:
p<-matrix(data$p) # price at time t
lp<-cbind(1,data$lp) # price at time t-1
2005 May 30
1
Trying to write a linear regression using MLE and optim()
I wrote this:
# Setup problem
x <- runif(100)
y <- 2 + 3*x + rnorm(100)
X <- cbind(1, x)
# True OLS --
lm(y ~ x)
# OLS likelihood function --
ols.lf <- function(theta, K, y, X) {
beta <- theta[1:K]
sigma <- exp(theta[K+1])
e <- (y - X%*%beta)/sigma
logl <- sum(log(dnorm(e)))
return(logl)
}
optim(c(2,3,0), ols.lf, gr=NULL,
method="BFGS",
2010 Mar 26
1
Problems if optimization
What's up fellows...
I am a begginer in R and i am trying to find the parameters of one
likelihood function, but when i otimize it, always appers a error or
advertisement and the solve does not occur.
The problem seems like that:
"lMix<-function(pars,y){
beta1<-pars[1]
beta2<-pars[2]
beta3<-pars[3]
beta4<-pars[4]
beta5<-pars[5]
alfa1<-pars[6]
2005 Nov 18
1
Truncated observations in survreg
Dear R-list
I have been trying to make survreg fit a normal regression model with left
truncated data, but unfortunately I am not able to figure out how to do it.
The following survreg-call seems to work just fine when the observations are
right censored:
library(survival)
n<-100000
#censored observations
x<-rnorm(n)
y<-rnorm(n,mean=x)
d<-data.frame(x,y)
d$ym<-pmin(y,0.5)
2009 Sep 14
1
Error: C stack usage is too close to the limit
R-help,
I 'm trying to optimize a model to data using log-likelihoods
but I encounter the following error message:
> l= c(49.4, 57.7,64.8,70.9,78.7,86.6,88.3,91.6,99,115)
> t=3:12
> fn <- function(params, l=l, t=t) {
Linf <- params[1]
k <- params[2]
t0 <- params[3]
sigma <- params[4]
2013 Apr 01
1
Parameter Estimation in R with Sums and Lagged Variables
Hi guys,
I am afraid I am stuck with an estimation problem.
I have two variables, X and Y. Y is explained by the weighted sum of n
lagged values of X. My aim is to estimate the two parameters
c(alpha0,alpha1) in:
Yt = Sum from j=1 to n of ( ( alpha0 + alpha1 * j ) * Xt-j )
Where Xt-j denotes the jth lag of X.
I came up with this approach because I thought it would be a good idea to
estimate