Displaying 20 results from an estimated 3000 matches similar to: "Help with apply"
2010 Sep 29
1
nlminb and optim
I am using both nlminb and optim to get MLEs from a likelihood function I have developed. AFAIK, the model I has not been previously used in this way and so I am struggling a bit to unit test my code since I don't have another data set to compare this kind of estimation to.
The likelihood I have is (in tex below)
\begin{equation}
\label{eqn:marginal}
L(\beta) = \prod_{s=1}^N \int
2009 Nov 29
1
optim or nlminb for minimization, which to believe?
I have constructed the function mml2 (below) based on the likelihood function described in the minimal latex I have pasted below for anyone who wants to look at it. This function finds parameter estimates for a basic Rasch (IRT) model. Using the function without the gradient, using either nlminb or optim returns the correct parameter estimates and, in the case of optim, the correct standard
2010 Nov 14
1
Integrate to 1? (gauss.quad)
Does anyone see why my code does not integrate to 1?
library(statmod)
mu <- 0
s <- 1
Q <- 5
qq <- gauss.quad(Q, kind='hermite')
sum((1/(s*sqrt(2*pi))) * exp(-((qq$nodes-mu)^2/(2*s^2))) * qq$weights)
### This does what's it is supposed to
myNorm <- function(theta) (1/(s*sqrt(2*pi))) * exp(-((theta-mu)^2/(2*s^2)))
integrate(myNorm, -Inf, Inf)
2012 Jul 15
1
how to extract p-value in GenMatch function
Dear R-Users,
I have a problem on extracting T-Stat and P-Value. I have written R-code below
library("Matching")
data("lalonde")
attach(lalonde)
names(lalonde)
Y <- lalonde$re78
Tr <- lalonde$treat
glm1 <- glm(Tr~age+educ+black+hisp+married+nodegr+re74+re75,family=binomial,data=lalonde)
pscore.predicted <- predict(glm1)
rr1 <-
2009 Jul 06
1
transform multi skew-t to uniform distribution
Hi R-users,
I have a data from multi skew t and would like to transform each of the data to uniform data. I tried using 'pmst' but only got one output:
> rr1 <- as.vector(r1);rr1
[1] 0.7207582 5.2250906 1.7422237 0.5677233 0.7473555 -0.6020626 -2.1947872 -1.1128313 -0.6587316 -1.1409261
> pmst(rr1, xi=rep(0,10), Omega=diag(10), alpha=rep(1,10), df=5)
[1] 3.676525e-09
2005 Nov 08
2
retrieve most abundant species by sample unit
Hi R-users:
[R 2.2 on OSX 10.4.3]
I have a (sparse) vegetation data frame with 500 rows (sampling
units) and 177 columns (plant species) where the data represent %
cover. I need to summarize the cover data by returning the names of
the most dominant and the second most dominant species per plot. I
reduced the data frame to omit cover below 5%; this is what it looks
like stacked. I have
2012 Oct 22
1
Matlab code to R code
Dear r-users,
I would like to convert my Matlab code to R-code, however it dies not work as expected. Hope somebody can help me to match Matlab and r codes.
R code:
rr <- function(r,cxn)
{
tol <- 1E-4;
for(i in 1:n)
{
t1 <- (1+(i-1)*r)*log((1+(i-1)*r))
t2 <- (i-1)*(1-r)*log(1-r)
rri <- ((t1+t2)/i*log(i))-cxn
rr <- rri > tol
}
round(rr,4)
}
rr1 <- rr(0.5,0.0242) ; rr1
2008 Aug 26
2
svymeans question
I have the following code which produces the output below it
clus1 <- svydesign(ids = ~schid, data = lower_dat)
items <- as.formula(paste(" ~ ", paste(lset, collapse= "+")))
rr1 <- svymean(items, clus1, deff='replace', na.rm=TRUE)
> rr1
mean SE DEff
W525209 0.719748 0.015606 2.4932
W525223 0.508228 0.027570 6.2802
W525035 0.827202
2013 Sep 10
1
[PATCH] show vector length in summary()
(summary.default): show the vector length in addition to quantiles
diff -u -i -p -F '^(def' -b -w -B /home/sds/src/R-3.0.1/src/library/base/R/summary.R.old /home/sds/src/R-3.0.1/src/library/base/R/summary.R
--- /home/sds/src/R-3.0.1/src/library/base/R/summary.R.old 2013-03-05 18:02:33.000000000 -0500
+++ /home/sds/src/R-3.0.1/src/library/base/R/summary.R 2013-09-10 10:19:02.682946339
2014 Mar 21
3
Local account login failed when samba join to LDAP
Dears,
My samba version is 3.6.4
I have a problem to co-work with open LDAP server. When samba join to open LDAP server, my local account can NOT login samba anymore, only LDAP account can login.
When my samba come back to standalone, the local account is OK. Did I miss something?
The following is my configuration files, I list the part of them,
smb.conf
server string = "Samba Server"
2013 Apr 05
1
mixed formatting of integer and numeric (e. g., by summary.default())
Hello, eveRybody,
I've been trying to find the origin for the following
formatting-"inconsistency":
E. g., look at the number of digits in summary.defaults()'s output when
NAs occur: in my example below the number of NA's is displayed as an
integer, the rest as numeric (floating point numbers):
> summary.default( c( 1:2, NA))
Min. 1st Qu. Median Mean 3rd Qu.
2009 Nov 01
2
Internal error in 'ls' for pathological environments (PR#14035)
nchar(with(list(2),ls())) gives an internal error. This is of course
a peculiar call (no names in the list), but the error is not caught
cleanly.
It is not clear from the documentation whether with(list(2)...) is
allowable; if it is not, it should presumably give an error. If it is, then
ls
shouldn't have problems with the resulting environment.
> qq <- with(list(2),ls())
2011 Feb 22
3
QQ International -- Almost works, but always says I'm "Away"
I got QQ International (version 1.0) to work via WINE under Mepis 8.5. Using winetricks, I installed all of the missing DLL's, and QQ now starts up and runs fine.
... except for the fact that it always shows me as being "Away". Even if I manually set my status to "Online", it changes me back to "Away" after a second or two.
This only happens under WINE. I log in
2012 Feb 17
1
QQ plot
Hello,
I am having two data set original and predicted.
I want to dind QQ-plot fot it.
I tried in following manner :
>qq(original~predicted)
and error was :
Error in qq.formula(o ~ p) : y must have exactly 2 levels
There is an option "qtype" which dosent make any difference.
What is the correct way for plotting QQ-plot or am I missing something.
--
Amar Kumar Nandan
2007 Mar 01
1
Generating R plots through Perl
Hello,
I am in the process of writing a Perl program to carry out and analyze
large numbers of regressions using R as the regression engine, and I am
using Statistics::R to create the communication bridge between the two
programs. Statistics::R creates a pipe between R and Perl and uses
Rterm.exe (hidden during run-time) to carry out the R commands. This
communication bridge works well for
2007 Nov 13
1
a very easy question, how to extract the name of the response variable
This may not be the smoothest way to produce the result, but here is a
two-step solution:
first find the formula within the object created by the call to glm():
form <- qq["formula"] or equivalently form <- qq$formula
then apply the function all.vars() to the result, and return the first
element
variables.in.formula <- all.vars(form)
variables.in.formula[1] # will be the
2010 Jun 08
10
QQ International - How to troubleshoot an app that wont run?
As I mentioned in the subject, I have installed the latest version of QQ International (beta 3), under wine in ubuntu lucid.
It installs without much trouble, however when I run the application, nothing happens.
How do I begin troubleshooting this application to see if I can make it work?
Or if anyone happens to know of an x64 linux qq client that actually works that would be great too :D
2001 Nov 09
2
confused by switch() and the letter E
I can't get switch() to work as expected with the letter 'E'. The following example from help works just fine.
> ccc <- c("b","QQ","a","A","bb")
> for(ch in ccc) cat(ch,":",switch(ch, a=1, b=2:3), "\n")
b : 2 3
QQ :
a : 1
A :
bb :
Now I replace "a=1" with "E=1"
2002 Jul 02
2
problem with qq( ) (PR#1729)
Full_Name: Jarno Tuimala
Version: 1.5.0
OS: Windows Nt
Submission from: (NULL) (193.166.1.21)
Running the following analysis gives as a result kukot vs. kisut.
aikaero <- -27.5+5*(0:10)
frekvenssi.m <- c(0,1,15,37,53,45,23,18,4,1,1)
frekvenssi.n <- c(2,8,12,19,33,47,42,15,2,1,0)
win.graph()
aikaero <- rep(c(aikaero,aikaero), c(frekvenssi.m,frekvenssi.n))
a.ero <-
2000 Feb 24
2
(-1 as index) OR (envelope for QQ)
I'm new to R (and to S) and am wondering about code from pages 72 and
83 of MASS (Venables+Ripley, 3rd edition), to draw an envelope on a QQ
plot. Copying from the book, I've got:
#... code whose gist is "a.fit <- nls(..."
num.points <- length(resid(a.fit))
qqnorm(residuals(a.fit)) # illustrate data-model residuals
qqline(residuals(a.fit))
samp <-