Displaying 20 results from an estimated 700 matches similar to: "code for double sum"
2009 Mar 23
4
newton method
Hi R-users,
Does R has a topic on newton's method?
Thank you for the info.
2010 Sep 15
1
Difficulty creating Julian day in data frame
Hi,
I'm attempting to add a "Julian Day" column to a data frame.
Here is my code and the resulting data frame:
vic.data <- read.table("C:/VIC/data/vic.data.csv", header=F)
names(vic.data) <- c("year", "month", "day", "precip", "evap",
"runoff", "baseflow", "Tsup",
2008 Oct 08
1
Suspicious output from lme4-mcmcsamp
Hello, R community,
I have been using the lmer and mcmcsamp functions in R with some difficulty. I do not believe this is my code or data, however, because my attempts to use the sample code and 'sleepstudy' data provided with the lme4 packaged (and used on several R-Wiki pages) do not return the same results as those indicated in the help pages. For instance:
> sessionInfo()
R
2011 Oct 06
0
linear classifiers with sparse matrices
I've been trying to get some linear classifiers (LiblineaR, kernlab,
e1071) to work with a sparse matrix of feature data. In the case of
LiblineaR and kernlab, it seems I have to coerce my data into a dense
matrix in order to train a model. I've done a number of searches,
read through the manuals and vignettes, but I can't seem to see how to
use either of these packages with sparse
2010 Feb 09
1
how to adjust the output
Hi R-users,
I have this code below and I understand the error message but do not know how to correct it. My question is how do I get rid of “with absolute error < 7.5e-06” attach to value of cdf so that I can carry out the calculation.
integrand <- function(z)
{ alp <- 2.0165
rho <- 0.868
# simplified expressions
a <- alp-0.5
c1 <-
2010 Feb 10
1
looping problem
Hi R-users,
I have this code here:
library(numDeriv)
fprime <- function(z)
{ alp <- 2.0165;
rho <- 0.868;
# simplified expressions
a <- alp-0.5
c1 <- sqrt(pi)/(gamma(alp)*(1-rho)^alp)
c2 <- sqrt(rho)/(1-rho)
t1 <- exp(-z/(1-rho))
t2 <- (z/(2*c2))^a
bes1 <- besselI(z*c2,a)
t1bes1 <- t1*bes1
c1*t1bes1*t2
}
## Newton
2010 Jun 07
2
mgcv
Hello Sir,
I am using mgcv package for my data.
My model is y~x1+f(x2),I want to find out the function f(x2) .
Following is the code.
sm1=gam(y~x1+s(x2),family=binomial, f)
summary(sm1)
plot(sm1,residuals=TRUE, xlab="AGE",pch=20)
In this plot I am getting S(x2,1.93) on y axixs
How should I get the function for x2 from this plot.or Is there anyother procedure in R to get this
2007 Nov 07
1
Aggregate with non-scalar function
R-Helpers,
I'm sorry to have to ask this -- I've not used R very much in the last
8 or 10 months, and I've gotten rusty.
I have the following (ff2 is a subset of a much, much larger dataset):
> ff2
hostName user sys idle obsTime
10142 fred 0.4 0.5 98.0 2007-11-01 02:02:18
16886 barney 0.5 0.2 94.6 2007-10-25 19:12:12
8795 fred 0.0 0.1 99.8
2010 Jul 12
1
ed50
I am using semiparametric Model
library(mgcv)
sm1=gam(y~x1+s(x2),family=binomial, f)
How should I find out standard error for ed50 for the above model
ED50 =( -sm1$coef[1]-f(x2)) / sm1$coef [2]
f(x2) is estimated value for non parametric term.
Thanks
[[alternative HTML version deleted]]
2009 Feb 25
1
monotonic GAM with more than one term
Hi,
Does anyone know how to fit a GAM where one or more smooth terms are
constrained to be monotonic, in the presence of "by" variables or
other terms? I looked at the example in ?pcls but so far have not been
able to adapt it to the case where there is more than one predictor.
For example,
require(mgcv)
set.seed(0)
n<-100
# Generate data from a monotonic truth.
2019 May 16
3
ALTREP: Bug reports
Hello Luke and Gabriel,
Thank you very much for your quick responses. The explanation of STDVEC is
very helpful and I appreciate it! For the wrapper, I have a few new
questions.
1. Like Luke said a mutable object is not possible. However, I noticed that
there is one extra argument *deep* in the function duplicate. I've googled
all the available documentation for ALTREP but I did not find
2018 Feb 15
3
wbinfo -U id gives different users on same dc
Sure there is,
Install debian, follow my howto and you will have success.
Just, your using an .local domain, and thats a reserved name for apples mDNS (zeroconf)
And should not be used. ( same for .lan )
https://wiki.samba.org/index.php/FAQ#Can_I_Use_the_.local_Top-level_Domain_for_My_AD_DNS_Zone.3F
So the info is good, thats not the problem, finding it, is.
Can you post your /etc/hosts
2001 Jan 24
3
sm.density
Hello to everyone
I''ve downloaded the version sm2 for smoothing methods and when I try the simple code
y <- rnorm(50)
sm.density(y, model = "Normal")
I get the error message
Error in if (any(omit)) { : missing value where logical needed
I''m running R 1.1.1. on windows 98
Anybody can help?
-------------- next part --------------
An HTML attachment was
2013 Feb 04
2
Modifying a function programmatically
Dear list
# I have a function
ff <- function(a,b=2,c=4){a+b+c}
# which I programmatically want to modify to a more specialized function in which a is replaced by 1
ff1 <- function(b=2,c=4){1+b+c}
# I do as follows:
vals <- list(a=1)
(expr1 <- as.expression(body(ff)))
expression({
a + b + c
})
(expr2 <- do.call("substitute", list(expr1[[1]], vals)))
{
1 +
2003 Aug 20
2
Method of L-BFGS-B of optim evaluate function outside of box constraints
Hi, R guys:
I'm using L-BFGS-B method of optim for minimization problem. My function
called besselI function which need non-negative parameter and the besselI
will overflow if the parameter is too large. So I set the constraint box
which is reasonable for my problem. But the point outside the box was
test, and I got error. My program and the error follows. This program
depends on CircStats
2007 Jun 18
1
two bessel function bugs for nu<0
#bug 1: besselI() for nu<0 and expon.scaled=TRUE
#tested with R-devel (2007-06-17 r41981)
x <- 2.3
nu <- -0.4
print(paste(besselI(x, nu, TRUE), "=", exp(-x)*besselI(x, nu, FALSE)))
#fix:
#$ diff bessel_i_old.c bessel_i_new.c
#57c57
#< bessel_k(x, -alpha, expo) * ((ize == 1)? 2. : 2.*exp(-x))/M_PI
#---
#> bessel_k(x, -alpha, expo) * ((ize == 1)? 2. :
2010 Jan 26
1
newton method for single nonlinear equation
Hi r-users,
I would like to solve for z values using newton iteration method. I 'm not sure which part of the code is wrong since I'm not very good at programming but would like to learn. There seem to be some output but what I expected is a vector of z values. Thank you so much for any help given.
newton.inputsingle <- function(pars,n)
{ runi <- runif(974, min=0, max=1)
2008 Jan 31
2
Odd things happening in ie6/ie7
As always, i am again having problems in IE6 and IE7 with scripts.
The scripting works fine in FF2, opera and Safari. IE just wont load
it. Could anyone help?
It''s a static page for now, located at www.maifith.com/research/index.html
The problem,although quite obvious, is that it doesn''t load the JS in
IE6 or IE7. Any help would be appreciated.
2008 Jun 20
3
FF3 printing problem on Centos 4.x
I'm using Centos 4.x (fully up to date) on a system at work. I have also
been using firefox 2 (directly from mozilla.org) on it for a long time,
and it tends to work just fine.
yesterday I installed the new FF3 release. It works fine too, with one
exception: The print dialog shows no printers! The print button is greyed
out! There actually four or five printers defined on the system, and all
2007 Jul 30
2
deriv, loop
Hi, 2 questions:
Question 1: example of what I currently do:
for(i in 1:6){sink("temp.txt",append=TRUE)
dput(i+0)
sink()}
x=scan(file="temp.txt")
print(prod(x))
file.remove("C:/R-2.5.0/temp.txt")
But how to convert the output of the loop to a vector that I can manipulate
(by prod or sum etc), without having to write and append to a file?
Question 2:
>