Displaying 20 results from an estimated 187 matches for "likly".
Did you mean:
likely
2009 Jan 05
2
Sweave data-figure coupling
Hi,
With the following Sweave minimal file:
---<--------------------cut here---------------start------------------->---
\documentclass{article}
\usepackage{Sweave}
\begin{document}
<<binom-sim>>=
thetas <- seq(0, 1, by=0.001)
prior <- rep(1, length(thetas)) / length(thetas)
lik <- dbinom(1, 1, thetas)
lik.p <- prior * lik
post <- lik.p / sum(lik.p)
2007 Oct 24
1
vectorized mle / optim
Hi the list,
I would need some advice on something that looks like a FAQ: the
possibility of providing vectors to optim() function.
Here is a stupid and short example summarizing the problem:
-------------------------------- example 1 ------------ 8<
----------------------
library(stats4)
data <- rnorm(100,0,1)
lik1 <- function(m, v, data) {
N <- length(data)
lik.mean <-
2011 Mar 19
2
problem running a function
Dear people,
I'm trying to do some analysis of a data using the models by Royle & Donazio
in their fantastic book, particular the following function:
http://www.mbr-pwrc.usgs.gov/pubanalysis/roylebook/panel4pt1.fn
that applied to my data and in the console is as follows:
> `desman.y` <- structure(c(3L,4L,3L,2L,1L), .Names = c("1", "2", "3",
2010 Jul 22
1
function return
I am sorry if this question is vague or uninformed. I am just
learning R and struggling. I am using the book Hierarchical Modeling
and Inference in Ecology and they provide examples of R code. I have
the following code from the book but when I run it I don't get any
output. I cannot get the values of 'out' to show up. Basically, I
just want to see my estimates for b0,
2012 Aug 08
1
dimnames in array
Hello,
I'm working with an array; I'm trying to make it so that an array of
dim(42,2,2) has names whose length corresponds to that of the array,
and am hoping someone with experience with this can see what I'm not
doing correctly:
data11 = array(0,c(41,2,2))
y = lsoda(x0,times,fhn$fn.ode,pars)#This is make.fhn() from colloc
infer package#
y = y[,2:3]
2012 Apr 13
1
R: Colouring phylogenetic tip labels and/or edges
Hi,
I have reconstructed ancestral character states on a phylogeny using MuSSE in the diversitree package and plotted the character state probabilities as pie charts on the nodes. I would, however, like to colour the character states of my extant species, i.e. the tip labels, the same colours as my pie charts, such that all species in state 1 are e.g. blue, species in state 2 red and species in
2006 Feb 07
1
sampling and nls formula
Hello,
I am trying to bootstrap a function that extracts the log-likelihood value and the nls coefficients from an nls object. I want to sample my dataset (pdd) with replacement and for each sampled dataset, I want to run nls and output the nls coefficients and the log-likelihood value.
Code:
x<-c(1,2,3,4,5,6,7,8,9,10)
y<-c(10,11,12,15,19,23,26,28,28,30)
pdd<-data.frame(x,y)
2005 May 23
2
Documentation of S3 and S4 classes, inheritance
I'd like to have a class A that computes a likelihood, and a subclass B
that computes the same likelihood by sometimes throws in an additional
term (B includes measurement error).
So B's likelihood needs to call A's, and then (sometimes) multiply by an
additional term.
It sounds as if, in the S3 scheme, NextMethod is supposed to do this:
like.A <- function(stuff) compute value
2007 Mar 06
2
Estimating parameters of 2 phase Coxian using optim
Hi,
My name is Laura. I'm a PhD student at Queen's University Belfast and have
just started learning R. I was wondering if somebody could help me to see
where I am going wrong in my code for estimating the parameters [mu1, mu2,
lambda1] of a 2-phase Coxian Distribution.
cox2.lik<-function(theta, y){
mu1<-theta[1]
mu2<-theta[2]
lambda1<-theta[3]
2009 Feb 25
3
indexing model names for AICc table
hi folks,
I'm trying to build a table that contains information about a series of
General Linear Models in order to calculate Akaike weights and other
measures to compare all models in the series.
i have an issue with indexing models and extracting the information
(loglikehood, AIC's, etc.) that I need to compile them into the table.
Below is some sample code that illustrates my
2005 Nov 11
1
optim not giving correct minima
Hello,
I am trying to use optim() on a function involving a summation. My
function basically is a thinned poisson likelihood. I have two parameters
and in most cases optim() does a fine job of getting the minima. I am
simulating my data based on pre specified parameters, so I know what I
should be getting. However when my true parameters fall in a particular
range, optim() gives
2012 Oct 20
4
Error in integrate(integrand, 0, Inf) : non-finite function value
Dear R users,
When I run the code below, I get the error "Error in integrate(integrand, 0,
Inf) : non-finite function value". The code works if the function returns
only "sum(integ)". However, I want to add "cmh" to it. When I add "cmh" I
get that error. I can't figure out why this is happening because my
integrate function has nothing to do with
2007 Nov 28
1
Power model in R
Um texto embutido e sem conjunto de caracteres especificado associado...
Nome: n?o dispon?vel
Url: https://stat.ethz.ch/pipermail/r-help/attachments/20071128/0d193362/attachment.pl
2009 Mar 23
0
Problems with adapt
Hi:
I'm trying to estimate a model which involves the estimation of double
integrals, so I'm using adapt procedure. I need to calculate the
integrals trough my 2000 size database, so I do it using a loop. My
code correctly estimates the integral for the first row, but for the
second R crashes. I tried changing the order of the data but the
result is the same so I guess there is something
2012 Mar 14
1
Metropolis-Hastings in R
Hi all,
I'm trying to write a MH algorithm in R for a standard normal distribution,
I've been trying for a good week or so now with multiple attempts and have
finally given up trying to do it on my own as I'm beginning to run out of
time for this, would somebody please tell me what is wrong with my latest
attempt:
n=100
mu=0
sigma=1
lik<-function(theta) exp(((theta-mu)^2)/2*sigma)
2011 May 23
6
Reading Data from mle into excel?
Hi there,
I ran the following code:
vols=read.csv(file="C:/Documents and Settings/Hugh/My Documents/PhD/Swaption
vols.csv"
, header=TRUE, sep=",")
X<-ts(vols[,2])
#X
dcOU<-function(x,t,x0,theta,log=FALSE){
Ex<-theta[1]/theta[2]+(x0-theta[1]/theta[2])*exp(-theta[2]*t)
Vx<-theta[3]^2*(1-exp(-2*theta[2]*t))/(2*theta[2])
dnorm(x,mean=Ex,sd=sqrt(Vx),log=log)
}
2010 Sep 30
3
how to avoid NaN in optim()
hi ,
lik <- function(nO, nA, nB, nAB){
loglik <- function(par)
{
p=par[1]
q=par[2]
r <- 1 - p - q
if (c(p,q,r) > rep(0,3) && c(p,q,r) < rep(1,3) )
{
-(2 * nO * log (r) + nA * log (p^2 + 2 * p * r)
+ nB * log (q^2 + 2 * q * r)
+ nAB * (log(2) +log(p) +log(q)))
}
else
NA
}
loglik
}
2012 Oct 19
2
likelihood function involving integration, error in nlm
Dear R users,
I am trying to find the mle that involves integration.
I am using the following code and get an error when I use the nlm function
d<-matrix(c(1,1,0,0,0,0,0,0,2,1,0,0,1,1,0,1,2,2,1,0),nrow=10,ncol=2)
h<-matrix(runif(20,0,1),10)
integ<-matrix(c(0),nrow=10, ncol=2)
ll<-function(p){
for (k in 1:2){
for(s in 1:10){
integrand<-function(x)
2011 Nov 20
2
ltm: Simplified approach to bootstrapping 2PL-Models?
Dear R-List,
to assess the model fit for 2PL-models, I tried to mimic the
bootstrap-approach chosen in the GoF.rasch()-function. Not being a
statistician, I was wondering whether the following simplification
(omit the "chi-squared-expressed model fit-step") would be appropriate:
GoF.ltm <- function(object, B = 50, ...){
liFits <- list()
for(i in 1:B){
rndDat <-
2012 Aug 13
4
dimnames in an array(I'll be grateful if this message will be passed to all list users)
Hello,
I'm hoping someone with a wide experience with R may be able to see
what the program is trying to tell me.
I've got an array:
y1=rnorm(41,0.2)
y2=rnorm(41,0.2)
y3=rbind(y1,y2)
data11<-array(0,c(41,2,2))
data11[,1,]=y3
data11[,2,]=y3
rownames(data11)<-rownames(data11, do.NULL = FALSE, prefix = "Obs.")
colnames=c("V","R")