Displaying 20 results from an estimated 8000 matches similar to: "using variables in obj$model"
2006 Nov 03
1
difference in using with() and the "data" argument in glm call
Dear all,
I am dealing with the following (apparently simple problem):
For some reasons I am interested in passing variables from a dataframe
to a specific environment, and in fitting a standard glm:
dati<-data.frame(y=rnorm(10),x1=runif(10),x2=runif(10))
KK<-new.env()
for(i in 1:ncol(dati)) assign(names(dati[i]),dati[[i]],envir=KK)
#Now the following two lines work correctly:
2006 Nov 03
1
[R] difference in using with() and the "data" argument in glm (PR#9338)
I've redirected this reply from r-help to the bugs list.
On 11/3/2006 8:25 AM, vito muggeo wrote:
> Dear all,
> I am dealing with the following (apparently simple problem):
> For some reasons I am interested in passing variables from a dataframe
> to a specific environment, and in fitting a standard glm:
>
> dati<-data.frame(y=rnorm(10),x1=runif(10),x2=runif(10))
>
2003 Mar 12
1
simulating 'non-standard' survival data
Dear all,
I'm looking for someone that help me to write an R function to simulate
survival data under complex situations, namely time-varying hazard ratio,
marginal distribution of survival times and covariates. The algorithm is
described in the reference below and it should be not very difficult to
implement it. However I tried but without success....;-(
Below there the code that I used; it
2009 Sep 04
1
predicting from segmented regression
Hello
I'm having trouble figuring out how to use the output of "segmented()"
with a new set of predictor values.
Using the example of the help file:
??set.seed(12)
xx<-1:100
zz<-runif(100)
yy<-2+1.5*pmax(xx-35,0)-1.5*pmax(xx-70,0)+15*pmax(zz-.5,0)+rnorm(100,0,2)
dati<-data.frame(x=xx,y=yy,z=zz)
out.lm<-lm(y~x,data=dati)
o<-## S3
2004 Nov 02
3
time dependency of Cox regression
Hi,
How can I specify a Cox proportional hazards model
with a covariate which i believe its strength on
survival changes/diminishes with time? The value of
the covariate was only recorded once at the beginning
of the study for each individual (e.g. at the
diagnosis of the disease), so I do not have the time
course data of the covariate for any given individual.
For example, I want to state at the
2007 Nov 28
3
using names with functions..
Dear all,
I have the following (rather) strange problem..
For some reasons, I finally work with a variable whose name includes an
R function, "a.log(z)", say. And that is a problem when I call it in a
formula, for instance:
> myname<-"a.log(z)"
> dd<-data.frame("a.log(z)"=1:10,y=rnorm(10))
> o<-lm(y~1,data=dd)
>
2004 Nov 10
1
Loading some function at R startup
Dear R-users,
I've built these functions usefell for me to
import/export data from/to Excel:
importa.da.excel<-function(){read.delim2("clipboard",
dec=",")
## questa funzione consente di importare dati da Excel
in R
## selezionare in Excel le celle che contengono i
dati,
## compresi in nomi delle colonne
## Autore: Vito Ricci email:vito_ricci at yahoo.com
## Data di
2003 Apr 17
4
A function as argument of another function
Dear all,
I would like to write a function like:
myfun<-function(x,fn) {xx<-exp(x); x*fn(xx)}
where fn is a symbolic description of any function with its argument to be
specified. Therefore
myfun(5,"2+0.3*y^2")
should return 5*(2+0.3*exp(5)^2),
myfun(5,"log(y)") should return 5*log(exp(5)) and so on.
I tried with "expression" and others, but without success.
2005 Jan 28
3
GLM fitting
DeaR R-useRs,
I'm trying to fit a logist model with these data:
> dati
y x
1 1 37
2 1 35
3 1 33
4 1 40
5 1 45
6 1 41
7 1 42
8 0 20
9 0 21
10 0 25
11 0 27
12 0 29
13 0 18
I use glm(), having this output:
> g<-glm(y~x,family=binomial,data=dati)
Warning messages:
1: Algorithm did not converge in: glm.fit(x = X, y =
Y, weights = weights, start = start, etastart =
2003 Dec 16
3
`bivariate apply'
dear all,
Given a matrix A, say, I would like to apply a bivariate function to each
combination of its colums. That is if
myfun<-function(x,y)cor(x,y) #computes simple correlation of two vectors x
and y
then the results should be something similar to cor(A).
I tried with mapply, outer,...but without success
Can anybody help me?
many thanks in advance,
vito
2001 Dec 21
1
pure statistical question
Dear all,
This is a pure statistical question, not necessarly related to R.
I could not find it in literature.
Suppose I'm intersted in a parameter rho, say, equal to:
r=beta1/beta2,
where beta1 and beta2 come from a linear model y=beta0+beta1X1+beta2X2+....
Fitting the model I can get the (biased) estimate of r=b1/b2, where b1 and
b2 are the estimates in the regression model; I can get the
2004 Oct 26
2
vcov method for 'coxph' objects
Dear all,
The help file for the generic function vcov states
"Classes with methods for this function include: 'lm', 'glm', 'nls', 'lme',
'gls', 'coxph' and 'survreg' (the last two in package 'survival')."
Since, I am not able to use vcov.coxph(), I am wondering whether I am
missing something (as I suspect..)
regards,
vito
2005 Jan 13
1
Re:Time-Series
Hi,
you can address to a single ts in a multivariate ts
object by namets[,index]. See this example:
> dati
X Y
1 100 200
2 150 210
3 180 220
4 200 230
5 220 250
> serie<-ts(dati,start=1999)
> serie
Time Series:
Start = 1999
End = 2003
Frequency = 1
X Y
1999 100 200
2000 150 210
2001 180 220
2002 200 230
2003 220 250
> serie[,1] ## first ts
Time Series:
Start =
2012 Jan 07
1
using deltat parameter in time series in HoltWinters prediction
Hi.
I have to forecast a time series of a Internet network traffic bitrate.
The data are in file
http://www.forumaltavilla.it/joomla/datitesi/dati.datand the sampling
time is every 0.05 seconds.
Now, i want to use HoltWinters forecasting. This is my script.
dt=1.58443823e-9 #0.05 seconds in years
dati.ts=ts(scan("dati.dat"),start=0,deltat=dt)
model=HoltWinters(dati.ts)
2005 Sep 23
2
Strange behaviour of as.Date function
Dear All,
I'm happily extracting data of temperature from an oracle db
under R via RODBC. After manipulating the extracted data I put them
into a data.frame 'dati' which is as follows:
> dati
DATA tm.
UDINE/RIVOLTO tm.TORINO/CASELLE
1 2005-07-01
22.35 23.80
2 2005-07-02 22.70
22.85
3 2005-07-03 23.80
2004 May 13
2
tapply & hist
I'm learning how to use tapply.
Now I'm having a go at the following code in which dati contains almost 600
lines, Pot - numeric - are the capacities of power plants and SGruppo - text
- the corresponding six technologies ("CCC", "CIC","TGC", "CSC","CPC", "TE").
.....................................................
2017 Feb 15
3
Samba AD domain member with SSSD: ACL not work
Have you seen :
( centos/redhat )
https://outsideit.net/realmd-sssd-ad-authentication/
( debian/ubuntu )
http://www.alandmoore.com/blog/2015/05/06/joining-debian-8-to-active-directory/
but i must say, i havent tested/tried these, i dont use sssd.
But i think these are usefull for you to read at least.
If you use the debian variant, you may need to install also :
One or more of these :
2001 Dec 03
1
fitting models with the subset argument
Hi all,
I'd like to fit model where the terms both are in the data.frame, mydata
say, and are vectors *not in the data.frame*.
>obj<-glm(y~x, data=mydata) #works
>Z<-pmax(mydata$x-20,0)
>(length(Z)==length(obj$y))
>[1] TRUE
>update(obj,.~.+Z) #works
However for some subset it doesn't works:
>obj<-glm(y~x, data=mydata, subset=f==1) #works
2017 Feb 14
3
Samba AD domain member with SSSD: ACL not work
On a Centos 7 minimal fresh install and samba 4.4.4 I have follow this
howto:
http://www.hexblot.com/blog/centos-7-active-directory-and-samba
and I have Joining to an Active Directory server and login to it with
domain user without problem.
My problem occur when I try from windows to modify some new rights
(ACL's) to new folder on samba share.
The folder is created correctly but if I add
2002 Nov 08
1
extracting response from arima obj
dear all,
Is it possible to extract the response vector from a fitted arima object?
For instance in glm it is allowed, by:
obj.glm<-glm(y~x)
obj.glm$y #the response vector
In arima I can't find it:
obj.arima<-arima(y, order=c(1,0,1)) #say
names(obj.arima) doesn't seem to include the response. Am I wrong?
Many thanks for your help,
best,
vito