Displaying 16 results from an estimated 16 matches for "xdat".
Did you mean:
dat
2008 Jun 07
2
Using lm with a matrix?
I'm trying to do a linear regression between the columns of matrices. In
example below I want to regress column 1 of matrix xdat with column1 of ydat
and do a separate regression between the column 2s of each matrix. But the
output I get seems to give correct slopes but incorrect intercepts and
another set of slopes with value NA. How do I do this correctly? I'm after
the slope and intercept of each columns regression...
1999 Jan 28
1
NAs spoil lowess smoothing
Can anyone explain to me what this error message means, why I'm getting it, and
how to fix it?
lines(lowess(xdat, ydat, f=.5), col=3)
Error: NAs in foreign function call (arg 1)
______________________________________________________________________
Stuart Luppescu -=-=- University of Chicago
ºÍʸ ¤ÈÃÒÆàÈþ¤ÎÉã(EUC) -=-=- s-luppescu at uchicago.edu
http://www.consortium-chicago.org/people/sl/sl.html...
2012 Apr 07
6
Drawing a line in xyplot
i am trying to replicate the following graph using xyplot :
attach(x)
plot ( jitter(type), mortality, pch=16, xlim = c(0.25, 3.75))
lines ( c(1-0.375,1.375) , c ( median(mortality[type==1]),
median(mortality[type==1])), lwd=5,col=2)
lines ( c(2-0.375,2.375) , c ( median(mortality[type==2]),
median(mortality[type==2])), lwd=5,col=2)
lines ( c(3-0.375,3.375) , c ( median(mortality[type==3]),
2012 Dec 30
4
How to multiple the vector and variables from dataframe
hi all:
Here's a dataframe(dat) and a vector(z):
dat:
x1 x2 x3
0.2 1.2 2.5
0.5 2 5
0.8 3 6.2
> z
[1] 10 100 100
I wanna do the following:
10*x1,100*x2,1000*x3
My solution is using the loop for z and dat(since the length of z is the same as ncol of dat),which is tedious.
I wanna an efficient solution to do it .
Any help?
Many thanks!
My best
2007 May 26
1
bug from nlm function (PR#9711)
...6) - (sum(.expr9 * .expr5)/.expr10 -
sum(.expr9) * (.expr10 * .expr2)/.expr19)
.grad[, "b"] <- -(.n*.expr23 - .n*.expr4 * .expr23 - sum(.expr9) * (b^.expr4
*
a)/.expr19)
attr(.value, "gradient") <- .grad
.value
}
> set.seed(99)
> xdat <-rweibull(42,shape=1,scale=20)
> sum(dweibull(xdat,1,20,log=T))
[1] -174.6415
3. Use the fllwfuncHnew function on nlm:
> source("fnlmw")
> fllwfuncHnew(1,20,xdat)
[1] -174.6415
attr(,"gradient")
a b
[1,] 30.88661 0.3410358
> nlm(fllw...
2011 Oct 14
1
Wilcoxon and the use of simulation
...statistic T = ?rank(Xi). For
n1=106 and n2=192, determine by simulation the ?=.05 critical point for
testing H0: ?=0, H1:?<0.
We can do this as follows:
For m=10000 (no wimpy m=200 or 500 as in the book),
draw m=10000 subsets of size 106 from the integers 1:298
using repeatedly the command
xdat = sample(1:298, size=106).
For each such subset, the value of the Wilcoxon is sum(xdat). Be sure to
answer the following question: why is it unnecessary to calculate ranks?
Any help would be greatly appreciately at this time.
--
View this message in context: http://r.789695.n4.nabble.com/Wilcox...
2011 Oct 21
2
How to use gev.fit (package ismev) under box constraints?
[This email is either empty or too large to be displayed at this time]
2006 Oct 11
4
Help on direction of axis in R needed
Hi!
I'd like to plot things with axes going from the
highest to the lowest value, so that e.g. high values
on the xaxis are plotted to the left and low values to
the right.
Could anyone tell me how this is done? I couldn't find
anything in the documentation.
Thanks a lot!
Silli
2005 Jan 23
5
How to use "identify"
I can't get identify to work, using R 2.0.1 under windows xp pro,
service pack 2. Here's what I enter, and the result:
> plot((our.frame2$c1),(our.frame2$c9)) # Produces desired plot
> identify(our.frame2$c1) # Plot comes to forefront, so I select a point
warning: no point with 0.25 inches
numeric(0)
Is my call to identify correct? The help page for indentify (from
2009 Feb 13
0
npindex: specifying manual bandwiths
...ible, but i couldn't manage so far; could you help ?
For instance,
#Simulation
n <- 200
x1 <- runif(n, min=-1, max=1)
x2 <- runif(n, min=-1, max=1)
y <- ifelse(x1 + x2 + rnorm(n) > 0, 1, 0)
#Klein and Spady estimation, letting np compute the bandwidth
npindexbw(bws=c(1,1,.5),xdat=cbind(x1,x2),ydat=y,bandwidth.compute=TRUE,method="kleinspady")
#Works fine!
#Klein and Spady estimation, attempting to constrain the bandwidth to .5
npindexbw(bws=c(1,1,.5),xdat=cbind(x1,x2),ydat=y,bandwidth.compute=FALSE,method="kleinspady")
#Returns a result with the startin...
2013 May 20
1
Accessing i'th element of a vector without using a macro
Hello,
I have a double vector, x. I can access the i'th element as
REAL(x)[i]
Is there a function for this? I know i can write my own, but was
seeing if one already exists. I did check Rinternals.h but didn't see
one.
Cheers
Saptarshi
2010 Mar 03
2
R beginner
...xt.
Can somebody help me to solve it.i'll very appreciate...
##GEV simulation(Non-stationary)
dsim<-function(n, alpha, beta,sca,sha){
t <- 1:n
location <- alpha + beta*t
inv.df<-function(x) location + -(sca/sha)+(sca/sha)*(-log(x))^(-sha)
u<-runif(n)
y<-inv.df(u)
return(y)
}
xdat<-c(3.4,7.8,10.1,11.7,13.9,14.1,14.2,14.6,14.6,14.6,15,15,16.1,18)
##GEV function(Non-stationary)
GEV.lik<-function(a,x)#a=(location,scale,shape)
{
alpha <- a[1]
beta <- a[2]
scale<-a[3]
shape<-a[4]
n <- length(x)
t <- 1:n
location<-100/(1+alpha*exp(beta*x))
if(scale<...
2011 Jul 18
0
np package, estimating the standard errors of Klein and Spady's estimator
...to estimate the standard errors of Klein and Spady's estimator
for that I am using:
library(np)
N<-100
X<-matrix(c(rnorm(N,1,1), rnorm(N,0,1)), ncol=2)
BETA <-matrix(1,2,1)
Z<-X%*%BETA
L<-rlogis(N,location=0, scale=1)
Y <-as.vector(X%*%BETA+L>=0)*1
KS <- npindexbw (xdat=X, ydat=Y, bandwidth.compute=TRUE,
method="kleinspady", ckertype="epanechnikov" )
KSi <- npindex(KS, errors=TRUE)
se(KSi)
But then I get as a result a vector Nx1, which I do not understand what it
is, and if I let errors=FALSE then I get a NA as a result. So, how can I get...
2011 Jul 20
0
np package, KleinSpady estimator, error when I estimate the bootstrapped standard errors
Dear all,
I am using np package in order to estimate a model with Klein and Spady
estimator. To estimate the model I use
KS <- npindexbw (xdat=X, ydat=Y, bandwidth.compute=TRUE,
method="kleinspady", optim.maxit=10^3, ckertype="epanechnikov", ckerorder=2)
and to estimate beta hats standard errors I use
KSi <- npindex(KS, gradients=T, boot.num=300)
vcov(KSi)
This is fine so far, but if I want to estimate the bootst...
2011 Jul 25
0
error in optimization when I include constant term in Klein and Spady (np package)
...? (I already tried all the
possible optimization methods)
The code that I run is:
library(np)
N<-250
q<-2
BETA<-matrix(1,3,1)
X<-matrix(c(rnorm(N,0,1), rnorm(N,1,1)), ncol=q)
X<-cbind(X,1)
L<-rlogis(N,location=0, scale=1)
Y <-as.vector(X%*%BETA+L>=0)*1
KS <- npindexbw(xdat=X, ydat=Y, bandwidth.compute=TRUE,
method="kleinspady", optim.maxit=10^3, ckertype="epanechnikov", ckerorder=2)
Thank you
Dimitris
--
View this message in context: http://r.789695.n4.nabble.com/error-in-optimization-when-I-include-constant-term-in-Klein-and-Spady-np-package-...
2012 Jul 19
1
npindex: fitted values of the function itself?
Dear list,
I am using the np package. With the npindex function I estimate a
semiparametric single index model using the method of Klein-Spady.
P(Z=1|X) = G(X?b)
I don?t have any problems to calculated the fitted values and standard
errors X?b:
bw = npindexbw(xdat=x, ydat=y_bi, method="kleinspady", nmulti=2)
model = npindex(bws= bw3, gradients= TRUE, residuals = TRUE, boot.num = 50)
x_fit = predict(model, se.fit = TRUE)
x_fit_bi= x_fit$fit
x_fit_bi_se = x_fit$se.fit
However, I also would like to obtain an estimate of G(X?b). For example,
after est...